testQemuMonitorJSONqemuMonitorJSONGetBlockInfo: virHashNew cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-07-05 16:36:01 +02:00
parent 92c35f5590
commit 091f22223b

View File

@ -1460,18 +1460,14 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque)
{ {
const testGenericData *data = opaque; const testGenericData *data = opaque;
virDomainXMLOption *xmlopt = data->xmlopt; virDomainXMLOption *xmlopt = data->xmlopt;
g_autoptr(GHashTable) blockDevices = NULL; g_autoptr(GHashTable) blockDevices = virHashNew(g_free);
g_autoptr(GHashTable) expectedBlockDevices = NULL; g_autoptr(GHashTable) expectedBlockDevices = virHashNew(g_free);
struct qemuDomainDiskInfo *info; struct qemuDomainDiskInfo *info;
g_autoptr(qemuMonitorTest) test = NULL; g_autoptr(qemuMonitorTest) test = NULL;
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema))) if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
return -1; return -1;
if (!(blockDevices = virHashNew(g_free)) ||
!(expectedBlockDevices = virHashNew(g_free)))
return -1;
info = g_new0(struct qemuDomainDiskInfo, 1); info = g_new0(struct qemuDomainDiskInfo, 1);
if (virHashAddEntry(expectedBlockDevices, "virtio-disk0", info) < 0) { if (virHashAddEntry(expectedBlockDevices, "virtio-disk0", info) < 0) {