[libvirt PATCH 9/9] qemu: use g_new0
Ján Tomko
jtomko at redhat.com
Tue Oct 6 11:15:08 UTC 2020
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;
>> }
>>
>
>[...]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201006/3403d6cb/attachment-0001.sig>
More information about the libvir-list
mailing list