[libvirt] [PATCH] fix memory leak in daemonUnixSocketPaths

Yi Wang posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1497247340-4009-1-git-send-email-wang.yi59@zte.com.cn
daemon/libvirtd.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] fix memory leak in daemonUnixSocketPaths
Posted by Yi Wang 6 years, 10 months ago
The @rundir is allocated in virGetUserRuntimeDirectory, may lost
when virFileMakePath failed.

Signed-off-by: Xi Xu <xu.xi8@zte.com.cn>
---
 daemon/libvirtd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index bac4bc1..d17a694 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -288,6 +288,7 @@ daemonUnixSocketPaths(struct daemonConfig *config,
             old_umask = umask(077);
             if (virFileMakePath(rundir) < 0) {
                 umask(old_umask);
+                VIR_FREE(rundir);
                 goto error;
             }
             umask(old_umask);
-- 
1.8.3.1


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list