[libvirt PATCH v2 08/11] qemuMonitorGetBlockInfo: `virHashNew` cannot return NULL

Tim Wiederhake twiederh at redhat.com
Tue Jul 6 12:37:56 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 2253c96cb5..f2c35ab173 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2103,13 +2103,10 @@ qemuDomainDiskInfoFree(void *value)
 GHashTable *
 qemuMonitorGetBlockInfo(qemuMonitor *mon)
 {
-    g_autoptr(GHashTable) table = NULL;
+    g_autoptr(GHashTable) table = virHashNew(qemuDomainDiskInfoFree);
 
     QEMU_CHECK_MONITOR_NULL(mon);
 
-    if (!(table = virHashNew(qemuDomainDiskInfoFree)))
-        return NULL;
-
     if (qemuMonitorJSONGetBlockInfo(mon, table) < 0) {
         return NULL;
     }
-- 
2.31.1




More information about the libvir-list mailing list