[PATCH v2] qemu_namespace: Don't leak mknod items that are being skipped over

Ján Tomko jtomko at redhat.com
Mon Sep 7 13:28:25 UTC 2020


On a Monday in 2020, Michal Privoznik wrote:
>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 at 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(-)
  

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200907/a6bf2255/attachment-0001.sig>


More information about the libvir-list mailing list