]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nodeinfo: Resolve Coverity NEGATIVE_RETURNS
authorJohn Ferlan <jferlan@redhat.com>
Thu, 4 Sep 2014 21:00:30 +0000 (17:00 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 11 Sep 2014 12:10:14 +0000 (08:10 -0400)
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 <jferlan@redhat.com>
src/nodeinfo.c

index 92a371866e1392457f453111e181e41db3585731..af23b8b2fb6d89343aea512690f4bcfccbd5af95 100644 (file)
@@ -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;
 }