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

Michal Privoznik mprivozn at redhat.com
Sat Mar 17 18:24:01 UTC 2018


On 03/17/2018 11:24 AM, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao at gmail.com>
> 
> fix a mem leak
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
> ---
>  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




More information about the libvir-list mailing list