[libvirt PATCH] Fix incorrect g_new0 conversions
Martin Kletzander
mkletzan at redhat.com
Tue Oct 6 12:52:28 UTC 2020
On Tue, Oct 06, 2020 at 01:15:01PM +0200, Ján Tomko wrote:
>I left in a 'return' or 'goto cleanup' in a few places that
>where I did the conversion manually.
>
Did you mean s/that// maybe?
>Signed-off-by: Ján Tomko <jtomko at redhat.com>
>Reported-by: John Ferlan <jferlan at redhat.com>
>---
> src/esx/esx_storage_backend_vmfs.c | 1 -
> src/libxl/libxl_capabilities.c | 2 --
> src/libxl/libxl_driver.c | 1 -
> src/qemu/qemu_hotplug.c | 1 -
> src/storage/storage_backend_iscsi_direct.c | 1 -
> tools/virt-login-shell-helper.c | 1 -
> 6 files changed, 7 deletions(-)
>
>diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
>index e397853bf7..c7a7863a61 100644
>--- a/src/esx/esx_storage_backend_vmfs.c
>+++ b/src/esx/esx_storage_backend_vmfs.c
>@@ -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,
>diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
>index 622cba1bfc..2f3ed5bc83 100644
>--- a/src/libxl/libxl_capabilities.c
>+++ b/src/libxl/libxl_capabilities.c
>@@ -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;
>diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
>index 446449fb33..e28c649688 100644
>--- a/src/libxl/libxl_driver.c
>+++ b/src/libxl/libxl_driver.c
>@@ -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);
>diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
>index 1aa8b497dd..7a54fcb221 100644
>--- a/src/qemu/qemu_hotplug.c
>+++ b/src/qemu/qemu_hotplug.c
>@@ -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)
>diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c
>index 66ceb48e6a..12b075db0b 100644
>--- a/src/storage/storage_backend_iscsi_direct.c
>+++ b/src/storage/storage_backend_iscsi_direct.c
>@@ -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);
>diff --git a/tools/virt-login-shell-helper.c b/tools/virt-login-shell-helper.c
>index 0e7987bf82..0522896eee 100644
>--- a/tools/virt-login-shell-helper.c
>+++ b/tools/virt-login-shell-helper.c
>@@ -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 {
>--
>2.26.2
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201006/b6a07b3d/attachment-0001.sig>
More information about the libvir-list
mailing list