mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
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:
parent
8617e8c8bb
commit
ce5ec2f1da
@ -498,7 +498,8 @@ 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;
|
||||||
|
|
||||||
glfs_fini(priv->vol);
|
if (priv->vol)
|
||||||
|
glfs_fini(priv->vol);
|
||||||
VIR_FREE(priv->volname);
|
VIR_FREE(priv->volname);
|
||||||
|
|
||||||
VIR_FREE(priv);
|
VIR_FREE(priv);
|
||||||
@ -571,7 +572,8 @@ virStorageFileBackendGlusterInit(virStorageFilePtr file)
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
VIR_FREE(priv->volname);
|
VIR_FREE(priv->volname);
|
||||||
glfs_fini(priv->vol);
|
if (priv->vol)
|
||||||
|
glfs_fini(priv->vol);
|
||||||
VIR_FREE(priv);
|
VIR_FREE(priv);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user