mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: Fix error path in storagePoolDefineXML
Found by inspection - after calling virStoragePoolObjAssignDef the pool is part of the driver->pools.objs list and the failure path for the virStoragePoolObjSaveDef will use virStoragePoolObjRemove to remove the pool from the objs list which will unlock and free the pool pointer (as pools->objs[i] during the loop). Since the call doesn't clear the pool address from the callee, we need to set it to NULL; otherwise, the virStoragePoolObjUnlock in the cleanup: code will fail miserably.
This commit is contained in:
parent
c53e4ae0c8
commit
ee67069c73
@ -784,6 +784,7 @@ storagePoolDefineXML(virConnectPtr conn,
|
|||||||
if (virStoragePoolObjSaveDef(driver, pool, def) < 0) {
|
if (virStoragePoolObjSaveDef(driver, pool, def) < 0) {
|
||||||
virStoragePoolObjRemove(&driver->pools, pool);
|
virStoragePoolObjRemove(&driver->pools, pool);
|
||||||
def = NULL;
|
def = NULL;
|
||||||
|
pool = NULL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
def = NULL;
|
def = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user