[PATCH v2 1/4] security_apparmor: fix memleaks in AppArmorSetFDLabel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Fixes: b9757fea30785a92aa95ea675b9bc371e4fb2e8c
Signed-off-by: Georgia Garcia <georgia.garcia@xxxxxxxxxxxxx>
---
 src/security/security_apparmor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 07e95ec81d..7092724563 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -1107,8 +1107,8 @@ AppArmorSetFDLabel(virSecurityManager *mgr,
                    virDomainDef *def,
                    int fd)
 {
-    char *proc = NULL;
-    char *fd_path = NULL;
+    g_autofree char *proc = NULL;
+    g_autofree char *fd_path = NULL;
 
     virSecurityLabelDef *secdef =
         virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
-- 
2.34.1



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux