mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
Fix incorrect g_new0 conversions
I left in a 'return' or 'goto cleanup' in a few places where I did the conversion manually. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reported-by: John Ferlan <jferlan@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
b15093d867
commit
37043008b7
@ -1195,7 +1195,6 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool,
|
||||
|
||||
if (priv->primary->hasQueryVirtualDiskUuid) {
|
||||
key = g_new0(char, VIR_UUID_STRING_BUFLEN);
|
||||
goto cleanup;
|
||||
|
||||
if (esxVI_QueryVirtualDiskUuid(priv->primary, datastorePath,
|
||||
priv->primary->datacenter->_reference,
|
||||
|
@ -284,7 +284,6 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps)
|
||||
|
||||
if (nr_cpus_node[node] == 1) {
|
||||
cpus[node] = g_new0(virCapsHostNUMACellCPU, 1);
|
||||
goto cleanup;
|
||||
} else {
|
||||
if (VIR_REALLOC_N(cpus[node], nr_cpus_node[node]) < 0)
|
||||
goto cleanup;
|
||||
@ -323,7 +322,6 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps)
|
||||
size_t j;
|
||||
|
||||
siblings = g_new0(virCapsHostNUMACellSiblingInfo, nr_siblings);
|
||||
goto cleanup;
|
||||
|
||||
for (j = 0; j < nr_siblings; j++) {
|
||||
siblings[j].node = j;
|
||||
|
@ -2762,7 +2762,6 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
|
||||
}
|
||||
|
||||
ret = g_new0(char, len);
|
||||
goto cleanup;
|
||||
|
||||
if (virConfWriteMem(ret, &len, conf) < 0) {
|
||||
VIR_FREE(ret);
|
||||
|
@ -1280,7 +1280,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
||||
tapfd = g_new0(int, tapfdSize);
|
||||
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
||||
vhostfd = g_new0(int, vhostfdSize);
|
||||
goto cleanup;
|
||||
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
||||
if (qemuInterfaceEthernetConnect(vm->def, driver, net,
|
||||
tapfd, tapfdSize) < 0)
|
||||
|
@ -626,7 +626,6 @@ virStorageBackendISCSIDirectVolWipeZero(virStorageVolDefPtr vol,
|
||||
if (virISCSIDirectGetVolumeCapacity(iscsi, lun, &block_size, &nb_block))
|
||||
return ret;
|
||||
data = g_new0(unsigned char, block_size * BLOCK_PER_PACKET);
|
||||
return ret;
|
||||
|
||||
while (lba < nb_block) {
|
||||
const uint64_t to_write = MIN(nb_block - lba + 1, BLOCK_PER_PACKET);
|
||||
|
@ -100,7 +100,6 @@ static int virLoginShellGetShellArgv(virConfPtr conf,
|
||||
|
||||
if (rv == 0) {
|
||||
*shargv = g_new0(char *, 2);
|
||||
return -1;
|
||||
(*shargv)[0] = g_strdup("/bin/sh");
|
||||
*shargvlen = 1;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user