From 18abe7d9e1ec7aa028330c3b2a70dd8e10314b2a Mon Sep 17 00:00:00 2001 From: Gao feng Date: Fri, 23 Oct 2015 21:58:48 +0800 Subject: [PATCH] do not cleanup exec in cleanup pod Let pts loop or signal loop do the cleanup job. fix the possible double free of exec. Signed-off-by: Gao feng --- src/container.c | 7 +++++++ src/exec.c | 3 ++- src/init.c | 1 - 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/container.c b/src/container.c index ec7f167..63a2d11 100644 --- a/src/container.c +++ b/src/container.c @@ -631,6 +631,13 @@ void hyper_cleanup_container(struct hyper_pod *pod) } free(c->maps); close(c->ns); + + free(c->exec.id); + for (i = 0; i < c->exec.argc; i++) { + //fprintf(stdout, "argv %d %s\n", i, exec->argv[i]); + free(c->exec.argv[i]); + } + free(c->exec.argv); } free(pod->c); diff --git a/src/exec.c b/src/exec.c index 4d5c62a..95826f2 100644 --- a/src/exec.c +++ b/src/exec.c @@ -637,7 +637,7 @@ int hyper_send_exec_eof(int to, struct hyper_pod *pod, return 0; } - +/* void hyper_cleanup_exec(struct hyper_pod *pod) { struct hyper_exec *exec, *next; @@ -647,3 +647,4 @@ void hyper_cleanup_exec(struct hyper_pod *pod) hyper_release_exec(exec, pod); } } +*/ diff --git a/src/init.c b/src/init.c index fd81cee..58c2ecb 100644 --- a/src/init.c +++ b/src/init.c @@ -938,7 +938,6 @@ static void hyper_cleanup_shared(struct hyper_pod *pod) void hyper_cleanup_pod(struct hyper_pod *pod) { - hyper_cleanup_exec(pod); hyper_cleanup_container(pod); hyper_cleanup_network(pod); hyper_cleanup_shared(pod);