From 1ff45609d6d455fecac8320f09e5cef64d26e879 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Wed, 12 Sep 2018 11:17:17 -0400 Subject: [PATCH] storage: Create error label path for storagePoolCreateXML Rather than duplicate the error code, let's create an error label to keep code common. Signed-off-by: John Ferlan ACKed-by: Michal Privoznik --- 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 6e7ce9f97c..8205f23a8c 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -727,12 +727,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"); @@ -743,10 +739,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, @@ -765,6 +758,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