[PATCH RFC 08/51] qemu: process: Consolidate error paths in qemuProcessHandleBlockJob

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'cleanup' label was accessed only from a jump to 'error'. Consolidate
everyting into 'cleanup'.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 72725fcdf1..3fccbc79bb 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -935,7 +935,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
               diskAlias, vm, vm->def->name, type, status);

     if (!(disk = qemuProcessFindDomainDiskByAliasOrQOM(vm, diskAlias, NULL)))
-        goto error;
+        goto cleanup;

     job = QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob;

@@ -949,11 +949,11 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     } else {
         /* there is no waiting SYNC API, dispatch the update to a thread */
         if (VIR_ALLOC(processEvent) < 0)
-            goto error;
+            goto cleanup;

         processEvent->eventType = QEMU_PROCESS_EVENT_BLOCK_JOB;
         if (VIR_STRDUP(data, diskAlias) < 0)
-            goto error;
+            goto cleanup;
         processEvent->data = data;
         processEvent->vm = virObjectRef(vm);
         processEvent->action = type;
@@ -961,16 +961,16 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,

         if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {
             ignore_value(virObjectUnref(vm));
-            goto error;
+            goto cleanup;
         }
+
+        processEvent = NULL;
     }

  cleanup:
+    qemuProcessEventFree(processEvent);
     virObjectUnlock(vm);
     return 0;
- error:
-    qemuProcessEventFree(processEvent);
-    goto cleanup;
 }


-- 
2.19.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux