1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-27 18:03:50 +03:00

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 <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2014-09-04 17:00:30 -04:00
parent 35a50ea8c7
commit 34476d720f

View 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;
}