From: John Ferlan Date: Thu, 4 Sep 2014 21:00:30 +0000 (-0400) Subject: nodeinfo: Resolve Coverity NEGATIVE_RETURNS X-Git-Tag: CVE-2014-3633~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34476d720fdb7fcd86f4a226064a6d9f3d93d550;p=thirdparty%2Flibvirt.git nodeinfo: Resolve Coverity NEGATIVE_RETURNS If the virNumaGetNodeCPUs() call fails with -1, then jumping to cleanup with 'cpus == NULL' and calling virCapabilitiesClearHostNUMACellCPUTopology will cause issues. Signed-off-by: John Ferlan --- diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 92a371866e..af23b8b2fb 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -1933,17 +1933,13 @@ nodeCapsInitNUMA(virCapsPtr caps) ret = 0; cleanup: - if (topology_failed || ret < 0) + if ((topology_failed || ret < 0) && cpus) virCapabilitiesClearHostNUMACellCPUTopology(cpus, ncpus); virBitmapFree(cpumap); VIR_FREE(cpus); VIR_FREE(siblings); VIR_FREE(pageinfo); - - if (ret < 0) - VIR_FREE(cpus); - return ret; }