
Coverity notes ...
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 11b549b12b..09f8525cfa 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -928,8 +928,7 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverPtr driver,
/* No SCSI controller present, for backward compatibility we * now hotplug a controller */ - if (VIR_ALLOC(cont) < 0) - return NULL; + cont = g_new0(virDomainControllerDef, 1); cont->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI; cont->idx = controller; if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT) @@ -1243,11 +1242,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (!tapfdSize) tapfdSize = vhostfdSize = 1; queueSize = tapfdSize; - if (VIR_ALLOC_N(tapfd, tapfdSize) < 0) - goto cleanup; + tapfd = g_new0(int, tapfdSize); memset(tapfd, -1, sizeof(*tapfd) * tapfdSize); - if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0) - goto cleanup; + vhostfd = g_new0(int, vhostfdSize); memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize); if (qemuInterfaceBridgeConnect(vm->def, driver, net, tapfd, &tapfdSize) < 0) @@ -1262,11 +1259,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (!tapfdSize) tapfdSize = vhostfdSize = 1; queueSize = tapfdSize; - if (VIR_ALLOC_N(tapfd, tapfdSize) < 0) - goto cleanup; + tapfd = g_new0(int, tapfdSize); memset(tapfd, -1, sizeof(*tapfd) * tapfdSize); - if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0) - goto cleanup; + vhostfd = g_new0(int, vhostfdSize); memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize); if (qemuInterfaceDirectConnect(vm->def, driver, net, tapfd, tapfdSize, @@ -1282,10 +1277,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (!tapfdSize) tapfdSize = vhostfdSize = 1; queueSize = tapfdSize; - if (VIR_ALLOC_N(tapfd, tapfdSize) < 0) - goto cleanup; + tapfd = g_new0(int, tapfdSize); memset(tapfd, -1, sizeof(*tapfd) * tapfdSize); - if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0) + vhostfd = g_new0(int, vhostfdSize); goto cleanup;
^^^ Everything below here is unreachable. FWIW: Similar issues after g_new0 calls in: libxlCapsInitNuma libxlConnectDomainXMLToNative virStorageBackendISCSIDirectVolWipeZero virLoginShellGetShellArgv John
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize); if (qemuInterfaceEthernetConnect(vm->def, driver, net, @@ -1381,9 +1375,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, goto cleanup; }
[...]