On 03/28/2014 04:01 PM, Peter Krempa wrote:
The libgfapi function glfs_fini doesn't tolerate NULL pointers.
Add a
check on the error paths as it's possible to crash libvirtd if the
gluster volume can't be initialized.
---
src/storage/storage_backend_gluster.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
ACK; safe for 1.2.3
diff --git a/src/storage/storage_backend_gluster.c
b/src/storage/storage_backend_gluster.c
index 5b79146..fe92f15 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -548,7 +548,8 @@ virStorageFileBackendGlusterDeinit(virStorageFilePtr file)
file, file->hosts[0].name, file->path);
virStorageFileBackendGlusterPrivPtr priv = file->priv;
- glfs_fini(priv->vol);
+ if (priv->vol)
+ glfs_fini(priv->vol);
VIR_FREE(priv->volname);
VIR_FREE(priv);
@@ -621,7 +622,8 @@ virStorageFileBackendGlusterInit(virStorageFilePtr file)
error:
VIR_FREE(priv->volname);
- glfs_fini(priv->vol);
+ if (priv->vol)
+ glfs_fini(priv->vol);
VIR_FREE(priv);
return -1;
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org