Fix leaks in vircapstest

Coverity complains about cell_cpus being leaked on error
and valgrind shows 'caps' is leaked on success.

Introduced in eb64e87.
This commit is contained in:
Ján Tomko 2014-02-12 10:29:18 +01:00
parent d385239260
commit 5b0dc11db8
1 changed files with 5 additions and 2 deletions

View File

@ -40,7 +40,7 @@ static virCapsPtr
buildNUMATopology(int seq)
{
virCapsPtr caps;
virCapsHostNUMACellCPUPtr cell_cpus;
virCapsHostNUMACellCPUPtr cell_cpus = NULL;
int core_id, cell_id;
int id;
@ -75,6 +75,8 @@ buildNUMATopology(int seq)
return caps;
error:
virCapabilitiesClearHostNUMACellCPUTopology(cell_cpus, MAX_CPUS_IN_CELL);
VIR_FREE(cell_cpus);
virObjectUnref(caps);
return NULL;
@ -87,7 +89,7 @@ test_virCapabilitiesGetCpusForNodemask(const void *data ATTRIBUTE_UNUSED)
const char *nodestr = "3,4,5,6";
virBitmapPtr nodemask = NULL;
virBitmapPtr cpumap = NULL;
virCapsPtr caps;
virCapsPtr caps = NULL;
int mask_size = 8;
int ret = -1;
@ -107,6 +109,7 @@ test_virCapabilitiesGetCpusForNodemask(const void *data ATTRIBUTE_UNUSED)
ret = 0;
error:
virObjectUnref(caps);
virBitmapFree(nodemask);
virBitmapFree(cpumap);
return ret;