When building and populating domain NS a couple of functions are
called that append paths to a string list. This string list is
then inspected, one item at the time by
qemuNamespacePrepareOneItem() which gathers all the info for
given path (stat buffer, possible link target, ACLs, SELinux
label) using qemuNamespaceMknodItemInit(). If the path needs to
be created in the domain's private /dev then it's added onto this
qemuNamespaceMknodData list which is freed later in the process.
But, if the path does not need to be created in the domain's
private /dev, then the memory allocated by
qemuNamespaceMknodItemInit() is not freed anywhere leading to a
leak.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
v2 of:
https://www.redhat.com/archives/libvir-list/2020-September/msg00248.html
diff to v2:
- autocleanup approach is implemented in qemuNamespacePrepareOneItem()
src/qemu/qemu_namespace.c | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)