1
0

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.
This commit is contained in:
Peter Krempa 2014-03-07 11:29:19 +01:00
parent 8617e8c8bb
commit ce5ec2f1da

View File

@ -498,6 +498,7 @@ virStorageFileBackendGlusterDeinit(virStorageFilePtr file)
file, file->hosts[0].name, file->path); file, file->hosts[0].name, file->path);
virStorageFileBackendGlusterPrivPtr priv = file->priv; virStorageFileBackendGlusterPrivPtr priv = file->priv;
if (priv->vol)
glfs_fini(priv->vol); glfs_fini(priv->vol);
VIR_FREE(priv->volname); VIR_FREE(priv->volname);
@ -571,6 +572,7 @@ virStorageFileBackendGlusterInit(virStorageFilePtr file)
error: error:
VIR_FREE(priv->volname); VIR_FREE(priv->volname);
if (priv->vol)
glfs_fini(priv->vol); glfs_fini(priv->vol);
VIR_FREE(priv); VIR_FREE(priv);