[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090901093159.GA6485@nowhere>
Date: Tue, 1 Sep 2009 11:32:02 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Li Zefan <lizf@...fujitsu.com>
Cc: Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
Tom Zanussi <tzanussi@...il.com>,
Masami Hiramatsu <mhiramat@...hat.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing/filters: Defer pred allocation, fix memory leak
On Tue, Sep 01, 2009 at 01:31:38PM +0800, Li Zefan wrote:
> Check if we have already allocated memory for filter preds.
>
> Spotted-by: Frederic Weisbecker <fweisbec@...il.com>
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@...il.com>
> ---
> kernel/trace/trace_events_filter.c | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index c6b2edf..93660fb 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c
> @@ -409,6 +409,9 @@ static int init_preds(struct ftrace_event_call *call)
> struct filter_pred *pred;
> int i;
>
> + if (call->filter)
> + return 0;
> +
> filter = call->filter = kzalloc(sizeof(*filter), GFP_KERNEL);
> if (!call->filter)
> return -ENOMEM;
> @@ -447,11 +450,9 @@ static int init_subsystem_preds(struct event_subsystem *system)
> if (strcmp(call->system, system->name) != 0)
> continue;
>
> - if (!call->filter) {
> - err = init_preds(call);
> - if (err)
> - return err;
> - }
> + err = init_preds(call);
> + if (err)
> + return err;
> }
>
> return 0;
> --
> 1.6.3
>
--
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