[lxc-devel] [lxc/master] Fix the memory leak in cgfsng_attach

lifeng68 on Github lxc-bot at linuxcontainers.org
Tue Apr 24 08:23:23 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 344 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180424/2883dba9/attachment.bin>
-------------- next part --------------
From 71cb9afb441b6c61b8229257aea1667e8c23ea33 Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68 at huawei.com>
Date: Tue, 24 Apr 2018 12:53:57 -0400
Subject: [PATCH] Fix the memory leak in cgfsng_attach

Signed-off-by: LiFeng <lifeng68 at huawei.com>
---
 src/lxc/cgroups/cgfsng.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index 10c7ab2cf..18d04ea25 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -2493,6 +2493,7 @@ static bool cgfsng_attach(const char *name, const char *lxcpath, pid_t pid)
 			continue;
 
 		fullpath = build_full_cgpath_from_monitorpath(h, path, "cgroup.procs");
+		free(path);
 		ret = lxc_write_to_file(fullpath, pidstr, len, false);
 		if (ret < 0) {
 			SYSERROR("Failed to attach %d to %s", (int)pid, fullpath);


More information about the lxc-devel mailing list