]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
xen: Resolve Coverity NEGATIVE_RETURNS
authorJohn Ferlan <jferlan@redhat.com>
Thu, 4 Sep 2014 21:11:57 +0000 (17:11 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 11 Sep 2014 12:10:14 +0000 (08:10 -0400)
Coverity notes that if the call to virBitmapParse() returns a negative
value, then when we jump to the error label, the call to
virCapabilitiesClearHostNUMACellCPUTopology() will have issues
with the negative nb_cpus

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/xen/xend_internal.c

index d9e76fc2ab423f2d25d00015828af0bf10cda5e7..f1322c438c22053039648485ad8fa7d5482db598 100644 (file)
@@ -1112,7 +1112,8 @@ sexpr_to_xend_topology(const struct sexpr *root, virCapsPtr caps)
  parse_error:
     virReportError(VIR_ERR_XEN_CALL, "%s", _("topology syntax error"));
  error:
-    virCapabilitiesClearHostNUMACellCPUTopology(cpuInfo, nb_cpus);
+    if (nb_cpus > 0)
+        virCapabilitiesClearHostNUMACellCPUTopology(cpuInfo, nb_cpus);
     VIR_FREE(cpuInfo);
     return -1;
 }