Re: [libvirt PATCH 9/9] qemu: use g_new0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Tuesday in 2020, John Ferlan wrote:
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
@@ -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


Thanks, patch sent.

Jano

John


         memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
         if (qemuInterfaceEthernetConnect(vm->def, driver, net,
@@ -1381,9 +1375,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
             goto cleanup;
     }


[...]

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux