Re: [libvirt-glib PATCHv4 2/7] gobject: Plug 2 virConnect leaks

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

 



Please be a bit more verbose in the commit log as to what the leak is.
(a virConnect reference is leaked in error cases, the unref is moved
after the label we jump to on errors to avoid the leak)

Looks good otherwise,

Christophe

On Wed, Jul 01, 2015 at 09:40:46PM +0100, Zeeshan Ali (Khattak) wrote:
> ---
>  libvirt-gobject/libvirt-gobject-connection.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
> index 1576906..dddbd3a 100644
> --- a/libvirt-gobject/libvirt-gobject-connection.c
> +++ b/libvirt-gobject/libvirt-gobject-connection.c
> @@ -748,7 +748,6 @@ gboolean gvir_connection_fetch_domains(GVirConnection *conn,
>      if (priv->domains)
>          g_hash_table_unref(priv->domains);
>      priv->domains = doms;
> -    virConnectClose(vconn);
>      g_mutex_unlock(priv->lock);
>  
>      ret = TRUE;
> @@ -759,6 +758,8 @@ cleanup:
>              virDomainFree(domains[i]);
>          free(domains);
>      }
> +    if (vconn != NULL)
> +        virConnectClose(vconn);
>      return ret;
>  }
>  
> @@ -835,7 +836,6 @@ gboolean gvir_connection_fetch_storage_pools(GVirConnection *conn,
>      if (priv->pools)
>          g_hash_table_unref(priv->pools);
>      priv->pools = pools;
> -    virConnectClose(vconn);
>      g_mutex_unlock(priv->lock);
>  
>      ret = TRUE;
> @@ -846,6 +846,8 @@ cleanup:
>              virStoragePoolFree(vpools[i]);
>          free(vpools);
>      }
> +    if (vconn != NULL)
> +        virConnectClose(vconn);
>      return ret;
>  }
>  
> -- 
> 2.4.3
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpo1V0RIojQH.pgp
Description: PGP signature

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