]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorGetMemoryDeviceInfo: `virHashNew` cannot return NULL
authorTim Wiederhake <twiederh@redhat.com>
Mon, 5 Jul 2021 14:03:19 +0000 (16:03 +0200)
committerTim Wiederhake <twiederh@redhat.com>
Wed, 14 Jul 2021 13:36:44 +0000 (15:36 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_monitor.c

index 0b5da8b71fd84c8aa718b2282c974aba5628644b..f66a3457c1989443440e3107e7509e20ada50565 100644 (file)
@@ -4214,7 +4214,7 @@ int
 qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
                                GHashTable **info)
 {
-    g_autoptr(GHashTable) hash = NULL;
+    g_autoptr(GHashTable) hash = virHashNew(g_free);
     int ret;
 
     VIR_DEBUG("info=%p", info);
@@ -4223,9 +4223,6 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
 
     QEMU_CHECK_MONITOR(mon);
 
-    if (!(hash = virHashNew(g_free)))
-        return -1;
-
     if ((ret = qemuMonitorJSONGetMemoryDeviceInfo(mon, hash)) >= 0)
         *info = g_steal_pointer(&hash);