]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix incorrect g_new0 conversions
authorJán Tomko <jtomko@redhat.com>
Tue, 6 Oct 2020 11:08:36 +0000 (13:08 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 6 Oct 2020 12:26:43 +0000 (14:26 +0200)
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>
src/esx/esx_storage_backend_vmfs.c
src/libxl/libxl_capabilities.c
src/libxl/libxl_driver.c
src/qemu/qemu_hotplug.c
src/storage/storage_backend_iscsi_direct.c
tools/virt-login-shell-helper.c

index e397853bf7e030dd8b59fcee028025038b1aabe5..c7a7863a61ec138263a88db6f6d5564c14331a3b 100644 (file)
@@ -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,
index 622cba1bfca2ac0e435d039da4fc766a0f9c851a..2f3ed5bc83cff4e9b592016368ae52de8d1fce2f 100644 (file)
@@ -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;
index 446449fb333518ce640eabb1dd0736a0cb654a08..e28c64968899dcf2cfa74fa29395e432206e9652 100644 (file)
@@ -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);
index 1aa8b497dd20a8c163ad423116f3a97bba06d15c..7a54fcb221c72a941fb1c42a53e25c82300e8a80 100644 (file)
@@ -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)
index 66ceb48e6ae295d946ec190c4bab1f3e51806c2d..12b075db0bc926ff9198c173129078f655114c0a 100644 (file)
@@ -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);
index 0e7987bf824c3d1823d3c40f9529ea6bd6f993d4..0522896eeeea7a2ac53651129e2a9f62ff6854a1 100644 (file)
@@ -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 {