[libvirt PATCH 06/10] qemuMonitorJSONGetAllBlockJobInfo: Use automatic memory management

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/qemu/qemu_monitor_json.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 472308e1d3..59c5eedb0a 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5069,12 +5069,12 @@ GHashTable *
 qemuMonitorJSONGetAllBlockJobInfo(qemuMonitor *mon,
                                   bool rawjobname)
 {
-    virJSONValue *cmd = NULL;
-    virJSONValue *reply = NULL;
+    g_autoptr(virJSONValue) cmd = NULL;
+    g_autoptr(virJSONValue) reply = NULL;
     virJSONValue *data;
     size_t nr_results;
     size_t i;
-    GHashTable *blockJobs = NULL;
+    g_autoptr(GHashTable) blockJobs = NULL;
 
     cmd = qemuMonitorJSONMakeCommand("query-block-jobs", NULL);
     if (!cmd)
@@ -5103,14 +5103,10 @@ qemuMonitorJSONGetAllBlockJobInfo(qemuMonitor *mon,
     }
 
  cleanup:
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    return blockJobs;
+    return g_steal_pointer(&blockJobs);
 
  error:
-    virHashFree(blockJobs);
-    blockJobs = NULL;
-    goto cleanup;
+    return NULL;
 }
 
 
-- 
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