From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oren Laadan Subject: Re: [PATCH 1/1] don't call pre_restore_task twice Date: Wed, 14 Oct 2009 18:24:53 -0400 Message-ID: <4AD64FB5.3040503@librato.com> References: <20091007234750.GA6881@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20091007234750.GA6881-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "Serge E. Hallyn" Cc: Linux Containers List-Id: containers.vger.kernel.org Pulled. Serge E. Hallyn wrote: > Pre_restore_task is being called both before and inside > restore_task, causing a memory leak at > current->checkpoint_data. > > Only call it once, outside restore_task. > > This fixes a memory leak spotted by Dan Smith, and the > actual bug was deduced by Matt Helsley. > > Signed-off-by: Serge E. Hallyn > Reported-by: Dan Smith > Cc: Dan Smith > Cc: Matt Helsley > > Signed-off-by: Serge E. Hallyn > --- > checkpoint/process.c | 4 ---- > checkpoint/restart.c | 1 + > 2 files changed, 1 insertions(+), 4 deletions(-) > > diff --git a/checkpoint/process.c b/checkpoint/process.c > index 424f688..c51e036 100644 > --- a/checkpoint/process.c > +++ b/checkpoint/process.c > @@ -864,10 +864,6 @@ int restore_task(struct ckpt_ctx *ctx) > { > int ret; > > - ret = pre_restore_task(ctx); > - if (ret < 0) > - goto out; > - > ret = restore_task_struct(ctx); > ckpt_debug("task %d\n", ret); > if (ret < 0) > diff --git a/checkpoint/restart.c b/checkpoint/restart.c > index 3a58a76..fc94374 100644 > --- a/checkpoint/restart.c > +++ b/checkpoint/restart.c > @@ -967,6 +967,7 @@ static int do_restore_task(void) > */ > if (zombie) { > restore_debug_exit(ctx); > + post_restore_task(ctx); > ckpt_ctx_put(ctx); > do_exit(current->exit_code); > }