提交 ce5ec2f1 编写于 作者: P Peter Krempa

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.
上级 8617e8c8
无相关合并请求
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册