[libvirt PATCH v2 10/10] qemuMonitorGetMemoryDeviceInfo: `virHashNew` cannot return NULL

Tim Wiederhake twiederh at redhat.com
Tue Jul 13 15:12:12 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_monitor.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 0b5da8b71f..f66a3457c1 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -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);
 
-- 
2.31.1




More information about the libvir-list mailing list