security_apparmor: fix memleaks in AppArmorSetFDLabel

proc and fd_path are allocated but never freed. Fix by using
g_autofree instead.

Fixes: b9757fea30785a92aa95ea675b9bc371e4fb2e8c
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Georgia Garcia 2025-01-07 12:23:36 -03:00 committed by Jim Fehlig
parent c97766a639
commit 76b9227eea

View File

@ -1109,8 +1109,8 @@ AppArmorSetFDLabel(virSecurityManager *mgr,
virDomainDef *def, virDomainDef *def,
int fd) int fd)
{ {
char *proc = NULL; g_autofree char *proc = NULL;
char *fd_path = NULL; g_autofree char *fd_path = NULL;
virSecurityLabelDef *secdef = virSecurityLabelDef *secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME); virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);