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

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

 



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@xxxxxxxxxx>
> ---
>  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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux