[libvirt] [PATCH 24/26] qemu: Resolve Coverity NEGATIVE_RETURNS
Peter Krempa
pkrempa at redhat.com
Thu Sep 11 09:52:18 UTC 2014
On 09/05/14 00:26, John Ferlan wrote:
> Coverity notes that if qemuMonitorGetMachines() returns a negative
> nmachines value, then the code at the cleanup label will have issues.
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
> src/qemu/qemu_capabilities.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 854a9b8..a652f29 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -2285,7 +2285,7 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps,
> size_t defIdx = 0;
>
> if ((nmachines = qemuMonitorGetMachines(mon, &machines)) < 0)
> - goto cleanup;
> + return -1;
Also nmachines doesn't need to be initialized.
>
> if (VIR_ALLOC_N(qemuCaps->machineTypes, nmachines) < 0)
> goto cleanup;
>
ACK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140911/d68717cb/attachment-0001.sig>
More information about the libvir-list
mailing list