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

Tim Wiederhake twiederh at redhat.com
Mon Jul 5 15:36:49 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh 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 2c43cc0788..a63056f0a0 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2885,16 +2885,13 @@ int
 qemuMonitorGetChardevInfo(qemuMonitor *mon,
                           GHashTable **retinfo)
 {
-    g_autoptr(GHashTable) info = NULL;
+    g_autoptr(GHashTable) info = virHashNew(qemuMonitorChardevInfoFree);
 
     VIR_DEBUG("retinfo=%p", retinfo);
 
     QEMU_CHECK_MONITOR(mon);
 
     *retinfo = NULL;
-    if (!(info = virHashNew(qemuMonitorChardevInfoFree)))
-        return -1;
-
     if (qemuMonitorJSONGetChardevInfo(mon, info) < 0)
         return -1;
 
-- 
2.31.1




More information about the libvir-list mailing list