mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 19:45:21 +00:00
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:
parent
d385239260
commit
5b0dc11db8
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user