[libvirt PATCH 04/10] qemuMonitorGetAllBlockStatsInfo: 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.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 86aabc98c3..f08b43bbfb 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2155,7 +2155,7 @@ qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon,
                                 bool backingChain)
 {
     int ret;
-    GHashTable *stats = virHashNew(g_free);
+    g_autoptr(GHashTable) stats = virHashNew(g_free);
 
     VIR_DEBUG("ret_stats=%p, backing=%d", ret_stats, backingChain);
 
@@ -2165,14 +2165,10 @@ qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon,
     ret = qemuMonitorJSONGetAllBlockStatsInfo(mon, stats, backingChain);
 
     if (ret < 0)
-        goto error;
+        return -1;
 
-    *ret_stats = stats;
+    *ret_stats = g_steal_pointer(&stats);
     return ret;
-
- error:
-    virHashFree(stats);
-    return -1;
 }
 
 
-- 
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