[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B0D261F.7050300@redhat.com>
Date:	Wed, 25 Nov 2009 07:42:07 -0500
From:	Masami Hiramatsu <mhiramat@...hat.com>
To:	Lai Jiangshan <laijs@...fujitsu.com>
CC:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] trace_kprobes: fix memory leak
Hi Lai,
Thank you for fixing bugs!
Acked-by: Masami Hiramatsu <mhiramat@...hat.com>
Lai Jiangshan wrote:
> 
> tp->nr_args is not set before we "goto error",
> it causes memory leak for free_trace_probe() use tp->nr_args
> to free memory of args.
> 
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> ---
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index 79ce6a2..82e8583 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -704,10 +704,12 @@ static int create_trace_probe(int argc, char **argv)
>  		ret = parse_probe_arg(arg, &tp->args[i].fetch, is_return);
>  		if (ret) {
>  			pr_info("Parse error at argument%d. (%d)\n", i, ret);
> +			kfree(tp->args[i].name);
>  			goto error;
>  		}
> +
> +		tp->nr_args++;
>  	}
> -	tp->nr_args = i;
>  
>  	ret = register_trace_probe(tp);
>  	if (ret)
> 
> 
-- 
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhiramat@...hat.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists