[PATCH 14/23] qemuProcessRefreshLegacyBlockjobs: Automatically free GHashTable and refactor cleanup

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

 



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

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 382d562fb1..5bbd03210b 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8540,22 +8540,17 @@ static int
 qemuProcessRefreshLegacyBlockjobs(virQEMUDriver *driver,
                                   virDomainObj *vm)
 {
-    GHashTable *blockJobs = NULL;
-    int ret = -1;
+    g_autoptr(GHashTable) blockJobs = NULL;

     qemuDomainObjEnterMonitor(driver, vm);
     blockJobs = qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), true);
     if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockJobs)
-        goto cleanup;
+        return -1;

     if (virHashForEach(blockJobs, qemuProcessRefreshLegacyBlockjob, vm) < 0)
-        goto cleanup;
-
-    ret = 0;
+        return -1;

- cleanup:
-    virHashFree(blockJobs);
-    return ret;
+    return 0;
 }


-- 
2.31.1




[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