[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v2 03/14] qemu: Move exit monitor calls in failure paths



On Thu, Feb 23, 2017 at 13:42:05 -0500, John Ferlan wrote:
> Since qemuDomainObjExitMonitor can also generate error messages,
> let's move it inside any error message saving code on error paths
> for various hotplug add activities.
> 
> Signed-off-by: John Ferlan <jferlan redhat com>
> ---
>  src/qemu/qemu_hotplug.c | 33 ++++++++++++++++-----------------
>  1 file changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 97fb272..9e2f04b 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
...
> @@ -2276,14 +2275,14 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
>      orig_err = virSaveLastError();
>      if (objAdded)
>          ignore_value(qemuMonitorDelObject(priv->mon, objalias));
> -    if (orig_err) {
> -        virSetError(orig_err);
> -        virFreeError(orig_err);
> -    }
>      if (qemuDomainObjExitMonitor(driver, vm) < 0) {
>          mem = NULL;
>          goto audit;
>      }
> +    if (orig_err) {
> +        virSetError(orig_err);
> +        virFreeError(orig_err);
> +    }
>  
>   removedef:
>      if ((id = virDomainMemoryFindByDef(vm->def, mem)) >= 0)

This hunk adds a memory leak and doesn't prevent
qemuDomainObjExitMonitor from overwriting the error message.

Jirka


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]