[libvirt] [libvirt-glib 2/5] gobject: Error out on NULL name in gvir_storage_pool_get_volume

Christophe Fergeau cfergeau at redhat.com
Tue Nov 13 17:30:28 UTC 2012


Without this change, gvir_storage_pool_get_volume segfaults when
trying to do the hash table lookup with a NULL 'name' key.
---
 libvirt-gobject/libvirt-gobject-storage-pool.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index dc34c2e..a380079 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -538,6 +538,7 @@ GVirStorageVol *gvir_storage_pool_get_volume(GVirStoragePool *pool,
     GVirStorageVol *volume;
 
     g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), NULL);
+    g_return_val_if_fail(name != NULL, NULL);
 
     priv = pool->priv;
     g_mutex_lock(priv->lock);
-- 
1.8.0




More information about the libvir-list mailing list