[lxc-devel] [PATCH] fix getline(3) memory leaks

Dwight Engen dwight.engen at oracle.com
Tue May 21 19:36:32 UTC 2013


Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
 src/lxc/attach.c | 2 +-
 src/lxc/cgroup.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index a7e9074..d8b4915 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -114,6 +114,7 @@ struct lxc_proc_context_info *lxc_proc_get_context_info(pid_t pid)
 		}
 	}
 
+	free(line);
 	fclose(proc_file);
 
 	if (!found) {
@@ -145,7 +146,6 @@ struct lxc_proc_context_info *lxc_proc_get_context_info(pid_t pid)
 
 out_error:
 	free(info);
-	free(line);
 	return NULL;
 }
 
diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
index 44266de..2ffbb54 100644
--- a/src/lxc/cgroup.c
+++ b/src/lxc/cgroup.c
@@ -503,6 +503,7 @@ static char *get_all_cgroups(void)
 	}
 
 out:
+	free(line);
 	fclose(f);
 	return ret;
 }
-- 
1.8.1.4





More information about the lxc-devel mailing list