[lxc-devel] [PATCH 2/5] attach: Fix minor memory leak in environment variable handling

Christian Seiler christian at iwakd.de
Sun Aug 18 22:52:41 UTC 2013


Signed-off-by: Christian Seiler <christian at iwakd.de>
---
 src/lxc/attach.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index 950fe9a..2e94b70 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -292,7 +292,13 @@ int lxc_attach_set_environment(enum lxc_attach_env_policy_t policy, char** extra
 		}
 
 		if (clearenv()) {
+			char **p;
 			SYSERROR("failed to clear environment");
+			if (extra_keep_store) {
+				for (p = extra_keep_store; *p; p++)
+					free(*p);
+				free(extra_keep_store);
+			}
 			return -1;
 		}
 
-- 
1.7.10.4





More information about the lxc-devel mailing list