From 34476d720fdb7fcd86f4a226064a6d9f3d93d550 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Thu, 4 Sep 2014 17:00:30 -0400 Subject: [PATCH] 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 --- src/nodeinfo.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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; }