[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160302073143.GB7272@krava>
Date: Wed, 2 Mar 2016 08:31:43 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Colin King <colin.king@...onical.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Steven Rostedt <rostedt@...dmis.org>,
Javi Merino <javi.merino@....com>,
He Kuang <hekuang@...wei.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf script: fix double free on command_line
On Tue, Mar 01, 2016 at 11:46:20PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> command_line is free'd twice if db_export__branch_types fails. To
> avoid this, defer the free'ing of command_line to after this call
> so that the error return path will just free command_line once.
>
Acked-by: Jiri Olsa <jolsa@...nel.org>
thanks,
jirka
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> tools/perf/util/scripting-engines/trace-event-python.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
> index d72fafc..e982863 100644
> --- a/tools/perf/util/scripting-engines/trace-event-python.c
> +++ b/tools/perf/util/scripting-engines/trace-event-python.c
> @@ -1091,8 +1091,6 @@ static int python_start_script(const char *script, int argc, const char **argv)
> goto error;
> }
>
> - free(command_line);
> -
> set_table_handlers(tables);
>
> if (tables->db_export_mode) {
> @@ -1101,6 +1099,8 @@ static int python_start_script(const char *script, int argc, const char **argv)
> goto error;
> }
>
> + free(command_line);
> +
> return err;
> error:
> Py_Finalize();
> --
> 2.7.0
>
Powered by blists - more mailing lists