]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorGetBlockInfo: Use automatic memory management
authorTim Wiederhake <twiederh@redhat.com>
Tue, 6 Jul 2021 12:37:55 +0000 (14:37 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 13 Jul 2021 12:40:28 +0000 (14:40 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_monitor.c

index 933d4a015491f24683751fa129b1be6b1994cdcd..2253c96cb55d9c942976b6f9656c45a6369a702d 100644 (file)
@@ -2103,7 +2103,7 @@ qemuDomainDiskInfoFree(void *value)
 GHashTable *
 qemuMonitorGetBlockInfo(qemuMonitor *mon)
 {
-    GHashTable *table;
+    g_autoptr(GHashTable) table = NULL;
 
     QEMU_CHECK_MONITOR_NULL(mon);
 
@@ -2111,11 +2111,10 @@ qemuMonitorGetBlockInfo(qemuMonitor *mon)
         return NULL;
 
     if (qemuMonitorJSONGetBlockInfo(mon, table) < 0) {
-        virHashFree(table);
         return NULL;
     }
 
-    return table;
+    return g_steal_pointer(&table);
 }