From b2e717c6c3c9463ee6ce727edf941a2d2ac7317f Mon Sep 17 00:00:00 2001 Message-Id: From: John Ferlan Date: Mon, 15 Sep 2014 15:13:53 -0400 Subject: [PATCH] qemu: Resolve Coverity NEGATIVE_RETURNS https://bugzilla.redhat.com/show_bug.cgi?id=1141209 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 (cherry picked from commit b74a3fb307f5e3743bba846956bddab1002b55c9) Signed-off-by: Jiri Denemark --- 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 c70a1a8..4e7c435 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; if (VIR_ALLOC_N(qemuCaps->machineTypes, nmachines) < 0) goto cleanup; -- 2.1.0