Rather than duplicate the error code, let's create an error
label to keep code common.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/storage/storage_driver.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index d0e7e6904c..5a8871bd07 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -730,12 +730,8 @@ storagePoolCreateXML(virConnectPtr conn,
}
if (backend->startPool &&
- backend->startPool(obj) < 0) {
- virStoragePoolObjRemove(driver->pools, obj);
- virObjectUnref(obj);
- obj = NULL;
- goto cleanup;
- }
+ backend->startPool(obj) < 0)
+ goto error;
stateFile = virFileBuildPath(driver->stateDir, def->name, ".xml");
@@ -746,10 +742,7 @@ storagePoolCreateXML(virConnectPtr conn,
unlink(stateFile);
if (backend->stopPool)
backend->stopPool(obj);
- virStoragePoolObjRemove(driver->pools, obj);
- virObjectUnref(obj);
- obj = NULL;
- goto cleanup;
+ goto error;
}
event = virStoragePoolEventLifecycleNew(def->name,
@@ -768,6 +761,12 @@ storagePoolCreateXML(virConnectPtr conn,
virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolObjEndAPI(&obj);
return pool;
+
+ error:
+ virStoragePoolObjRemove(driver->pools, obj);
+ virObjectUnref(obj);
+ obj = NULL;
+ goto cleanup;
}
static virStoragePoolPtr
--
2.17.1