[PATCH 11/23] qemuRefreshPRManagerState: 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 | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 8dface7ec0..2fdd5b95e2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2291,26 +2291,19 @@ qemuRefreshPRManagerState(virQEMUDriver *driver,
                           virDomainObj *vm)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
-    GHashTable *info = NULL;
-    int ret = -1;
+    g_autoptr(GHashTable) info = NULL;
+    int rc;

     if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER) ||
         !qemuDomainDefHasManagedPR(vm))
         return 0;

     qemuDomainObjEnterMonitor(driver, vm);
-    ret = qemuMonitorGetPRManagerInfo(priv->mon, &info);
-    if (qemuDomainObjExitMonitor(driver, vm) < 0)
-        ret = -1;
-
-    if (ret < 0)
-        goto cleanup;
-
-    ret = qemuProcessRefreshPRManagerState(vm, info);
+    rc = qemuMonitorGetPRManagerInfo(priv->mon, &info);
+    if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
+        return -1;

- cleanup:
-    virHashFree(info);
-    return ret;
+    return qemuProcessRefreshPRManagerState(vm, info);
 }


-- 
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