From: Michal Privoznik Date: Tue, 14 May 2019 08:31:52 +0000 (+0200) Subject: virstorageobj: Don't clear vols if they weren't initialized X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0cf3bb805c6f5fd42e705567b74df1423b0aaed3;p=libvirt.git virstorageobj: Don't clear vols if they weren't initialized If virStoragePoolObjNew() fails to create new volume object list then virObjectUnref() is called and since refcounter is 1 then virStoragePoolObjDispose() is called which in turn calls virStoragePoolObjClearVols() which in turn dereferences obj->volumes. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 1d6c9d1937..cdd9863eb8 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -619,6 +619,9 @@ virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr obj, void virStoragePoolObjClearVols(virStoragePoolObjPtr obj) { + if (!obj->volumes) + return; + virHashRemoveAll(obj->volumes->objsKey); virHashRemoveAll(obj->volumes->objsName); virHashRemoveAll(obj->volumes->objsPath);