[libvirt] [PATCH libvirt-glib 5/5] Ensure domains & pools hash tables in connection are non-NULL

Christophe Fergeau cfergeau at redhat.com
Tue Nov 22 13:22:40 UTC 2011


Hi,

I assume without this, it's easy to try to add data to NULL hash tables
when using the transient domain API you added in this patch series?
ACK patch, just curious...

Christophe

On Tue, Nov 22, 2011 at 12:39:32PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> ---
>  libvirt-gobject/libvirt-gobject-connection.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
> index b6e7f3b..affb496 100644
> --- a/libvirt-gobject/libvirt-gobject-connection.c
> +++ b/libvirt-gobject/libvirt-gobject-connection.c
> @@ -234,9 +234,15 @@ static void gvir_connection_init(GVirConnection *conn)
>  
>      priv = conn->priv = GVIR_CONNECTION_GET_PRIVATE(conn);
>  
> -    memset(priv, 0, sizeof(*priv));
> -
>      priv->lock = g_mutex_new();
> +    priv->domains = g_hash_table_new_full(g_str_hash,
> +                                          g_str_equal,
> +                                          NULL,
> +                                          g_object_unref);
> +    priv->pools = g_hash_table_new_full(g_str_hash,
> +                                        g_str_equal,
> +                                        NULL,
> +                                        g_object_unref);
>  }
>  
>  
> -- 
> 1.7.6.4
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111122/a0e0073f/attachment-0001.sig>


More information about the libvir-list mailing list