mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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) {
|
if (priv->primary->hasQueryVirtualDiskUuid) {
|
||||||
key = g_new0(char, VIR_UUID_STRING_BUFLEN);
|
key = g_new0(char, VIR_UUID_STRING_BUFLEN);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (esxVI_QueryVirtualDiskUuid(priv->primary, datastorePath,
|
if (esxVI_QueryVirtualDiskUuid(priv->primary, datastorePath,
|
||||||
priv->primary->datacenter->_reference,
|
priv->primary->datacenter->_reference,
|
||||||
|
@ -284,7 +284,6 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps)
|
|||||||
|
|
||||||
if (nr_cpus_node[node] == 1) {
|
if (nr_cpus_node[node] == 1) {
|
||||||
cpus[node] = g_new0(virCapsHostNUMACellCPU, 1);
|
cpus[node] = g_new0(virCapsHostNUMACellCPU, 1);
|
||||||
goto cleanup;
|
|
||||||
} else {
|
} else {
|
||||||
if (VIR_REALLOC_N(cpus[node], nr_cpus_node[node]) < 0)
|
if (VIR_REALLOC_N(cpus[node], nr_cpus_node[node]) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -323,7 +322,6 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps)
|
|||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
siblings = g_new0(virCapsHostNUMACellSiblingInfo, nr_siblings);
|
siblings = g_new0(virCapsHostNUMACellSiblingInfo, nr_siblings);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
for (j = 0; j < nr_siblings; j++) {
|
for (j = 0; j < nr_siblings; j++) {
|
||||||
siblings[j].node = j;
|
siblings[j].node = j;
|
||||||
|
@ -2762,7 +2762,6 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = g_new0(char, len);
|
ret = g_new0(char, len);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virConfWriteMem(ret, &len, conf) < 0) {
|
if (virConfWriteMem(ret, &len, conf) < 0) {
|
||||||
VIR_FREE(ret);
|
VIR_FREE(ret);
|
||||||
|
@ -1280,7 +1280,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
tapfd = g_new0(int, tapfdSize);
|
tapfd = g_new0(int, tapfdSize);
|
||||||
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
||||||
vhostfd = g_new0(int, vhostfdSize);
|
vhostfd = g_new0(int, vhostfdSize);
|
||||||
goto cleanup;
|
|
||||||
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
||||||
if (qemuInterfaceEthernetConnect(vm->def, driver, net,
|
if (qemuInterfaceEthernetConnect(vm->def, driver, net,
|
||||||
tapfd, tapfdSize) < 0)
|
tapfd, tapfdSize) < 0)
|
||||||
|
@ -626,7 +626,6 @@ virStorageBackendISCSIDirectVolWipeZero(virStorageVolDefPtr vol,
|
|||||||
if (virISCSIDirectGetVolumeCapacity(iscsi, lun, &block_size, &nb_block))
|
if (virISCSIDirectGetVolumeCapacity(iscsi, lun, &block_size, &nb_block))
|
||||||
return ret;
|
return ret;
|
||||||
data = g_new0(unsigned char, block_size * BLOCK_PER_PACKET);
|
data = g_new0(unsigned char, block_size * BLOCK_PER_PACKET);
|
||||||
return ret;
|
|
||||||
|
|
||||||
while (lba < nb_block) {
|
while (lba < nb_block) {
|
||||||
const uint64_t to_write = MIN(nb_block - lba + 1, BLOCK_PER_PACKET);
|
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) {
|
if (rv == 0) {
|
||||||
*shargv = g_new0(char *, 2);
|
*shargv = g_new0(char *, 2);
|
||||||
return -1;
|
|
||||||
(*shargv)[0] = g_strdup("/bin/sh");
|
(*shargv)[0] = g_strdup("/bin/sh");
|
||||||
*shargvlen = 1;
|
*shargvlen = 1;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user