Re: [PATCH 2/2] qemu: fix a mem leak

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

 



On 03/17/2018 11:24 AM, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
> 
> fix a mem leak
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 5c55c69af..14b72a8f6 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -20682,6 +20682,8 @@ qemuARPGetInterfaces(virDomainObjPtr vm,
>  
>                  if (VIR_APPEND_ELEMENT(ifaces_ret, ifaces_count, iface) < 0)
>                      goto cleanup;
> +
> +                virDomainInterfaceFree(iface);

This makes no sense. In fact would be totally wrong if only
VIR_APPEND_ELEMENT wouldn't set iface = NULL on successful return.

>              }
>          }
>      }
> @@ -20691,6 +20693,7 @@ qemuARPGetInterfaces(virDomainObjPtr vm,
>  
>   cleanup:
>      virArpTableFree(table);
> +    virDomainInterfaceFree(iface);
>  
>      if (ifaces_ret) {
>          for (i = 0; i < ifaces_count; i++)
> 

ACK to this hunk though.

Michal

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