From: John Ferlan Date: Thu, 4 Sep 2014 21:18:48 +0000 (-0400) Subject: qemu: Resolve Coverity NEGATIVE_RETURNS X-Git-Tag: CVE-2014-3633~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81a8fc34ad79386deb774f1e234797ae3641584c;p=thirdparty%2Flibvirt.git qemu: Resolve Coverity NEGATIVE_RETURNS Coverity notes that if the virConnectListAllDomains returns a negative value then the loop at the cleanup label that ends on numDomains will have issues. Signed-off-by: John Ferlan --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 78b8a82607..7ff60ecfe6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1004,9 +1004,11 @@ qemuStateStop(void) ret = -1; cleanup: - for (i = 0; i < numDomains; i++) - virDomainFree(domains[i]); - VIR_FREE(domains); + if (domains) { + for (i = 0; i < numDomains; i++) + virDomainFree(domains[i]); + VIR_FREE(domains); + } VIR_FREE(flags); virObjectUnref(conn); virObjectUnref(cfg);