In case the host has 2 or more NUMA nodes, we fetch CPU map for each
node. However, we need to free the CPU map in between loops:
==29513== 96 (72 direct, 24 indirect) bytes in 3 blocks are definitely lost in loss record
951 of 1,264
==29513== at 0x4C2A700: calloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==29513== by 0x52AD24B: virAlloc (viralloc.c:144)
==29513== by 0x52AF0E6: virBitmapNew (virbitmap.c:78)
==29513== by 0x52FB720: virNumaGetNodeCPUs (virnuma.c:294)
==29513== by 0x53C700B: nodeCapsInitNUMA (nodeinfo.c:1886)
==29513== by 0x11759708: vboxCapsInit (vbox_common.c:398)
==29513== by 0x11759CC4: vboxConnectOpen (vbox_common.c:514)
==29513== by 0x53C965F: do_open (libvirt.c:1147)
==29513== by 0x53C9EBC: virConnectOpen (libvirt.c:1317)
==29513== by 0x142905: remoteDispatchConnectOpen (remote.c:1215)
==29513== by 0x126ADF: remoteDispatchConnectOpenHelper (remote_dispatch.h:2346)
==29513== by 0x5453D21: virNetServerProgramDispatchCall (virnetserverprogram.c:437)
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/nodeinfo.c | 2 ++
src/util/virnuma.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 2c1c437..92a3718 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -1926,6 +1926,8 @@ nodeCapsInitNUMA(virCapsPtr caps)
cpus = NULL;
siblings = NULL;
pageinfo = NULL;
+ virBitmapFree(cpumap);
+ cpumap = NULL;
}
ret = 0;
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index 9e6e5f7..1a34398 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -308,7 +308,7 @@ virNumaGetNodeCPUs(int node,
cleanup:
VIR_FREE(mask);
VIR_FREE(allonesmask);
- VIR_FREE(cpumap);
+ virBitmapFree(cpumap);
return ret;
}
--
1.8.5.5