From: Peter Krempa Date: Fri, 7 Mar 2014 10:29:19 +0000 (+0100) Subject: storage: gluster: Fix crash when initialization of storage backend fails X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ce5ec2f1da21e605a9e4ab53ab8b08323c554298;p=libvirt.git storage: gluster: Fix crash when initialization of storage backend fails 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. --- diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 9a6180e2ca..5e0acc0651 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -498,7 +498,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); @@ -571,7 +572,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;