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

Tim Wiederhake twiederh at redhat.com
Mon Jul 12 09:34:14 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 tests/qemumonitorjsontest.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 7fd58dc2d1..89ede3b59a 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1460,18 +1460,14 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque)
 {
     const testGenericData *data = opaque;
     virDomainXMLOption *xmlopt = data->xmlopt;
-    g_autoptr(GHashTable) blockDevices = NULL;
-    g_autoptr(GHashTable) expectedBlockDevices = NULL;
+    g_autoptr(GHashTable) blockDevices = virHashNew(g_free);
+    g_autoptr(GHashTable) expectedBlockDevices = virHashNew(g_free);
     struct qemuDomainDiskInfo *info;
     g_autoptr(qemuMonitorTest) test = NULL;
 
     if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
         return -1;
 
-    if (!(blockDevices = virHashNew(g_free)) ||
-        !(expectedBlockDevices = virHashNew(g_free)))
-        return -1;
-
     info = g_new0(struct qemuDomainDiskInfo, 1);
 
     if (virHashAddEntry(expectedBlockDevices, "virtio-disk0", info) < 0) {
-- 
2.31.1




More information about the libvir-list mailing list