* [PATCH] perf script: fix double free on command_line
@ 2016-03-01 23:46 Colin King
2016-03-02 7:31 ` Jiri Olsa
2016-03-05 8:18 ` [tip:perf/core] perf script: Fix " tip-bot for Colin Ian King
0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2016-03-01 23:46 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Jiri Olsa, Adrian Hunter, Steven Rostedt,
Javi Merino, He Kuang
Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.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.
Signed-off-by: Colin Ian King <colin.king@canonical.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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf script: fix double free on command_line
2016-03-01 23:46 [PATCH] perf script: fix double free on command_line Colin King
@ 2016-03-02 7:31 ` Jiri Olsa
2016-03-02 12:13 ` Arnaldo Carvalho de Melo
2016-03-05 8:18 ` [tip:perf/core] perf script: Fix " tip-bot for Colin Ian King
1 sibling, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2016-03-02 7:31 UTC (permalink / raw)
To: Colin King
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Jiri Olsa, Adrian Hunter, Steven Rostedt,
Javi Merino, He Kuang, linux-kernel
On Tue, Mar 01, 2016 at 11:46:20PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.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@kernel.org>
thanks,
jirka
> Signed-off-by: Colin Ian King <colin.king@canonical.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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf script: fix double free on command_line
2016-03-02 7:31 ` Jiri Olsa
@ 2016-03-02 12:13 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-02 12:13 UTC (permalink / raw)
To: Jiri Olsa
Cc: Colin King, Peter Zijlstra, Ingo Molnar, Namhyung Kim, Jiri Olsa,
Adrian Hunter, Steven Rostedt, Javi Merino, He Kuang,
linux-kernel
Em Wed, Mar 02, 2016 at 08:31:43AM +0100, Jiri Olsa escreveu:
> On Tue, Mar 01, 2016 at 11:46:20PM +0000, Colin King wrote:
> > 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@kernel.org>
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/core] perf script: Fix double free on command_line
2016-03-01 23:46 [PATCH] perf script: fix double free on command_line Colin King
2016-03-02 7:31 ` Jiri Olsa
@ 2016-03-05 8:18 ` tip-bot for Colin Ian King
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Colin Ian King @ 2016-03-05 8:18 UTC (permalink / raw)
To: linux-tip-commits
Cc: peterz, linux-kernel, tglx, rostedt, acme, namhyung,
adrian.hunter, hpa, jolsa, mingo, javi.merino, hekuang,
colin.king
Commit-ID: 979ac257b00c53aacec3eacf86142e8c00bee889
Gitweb: http://git.kernel.org/tip/979ac257b00c53aacec3eacf86142e8c00bee889
Author: Colin Ian King <colin.king@canonical.com>
AuthorDate: Tue, 1 Mar 2016 23:46:20 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 3 Mar 2016 11:10:37 -0300
perf script: Fix double free on command_line
The 'command_line' variable 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.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Javi Merino <javi.merino@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1456875980-25606-1-git-send-email-colin.king@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.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 309d90f..fbd0524 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -1094,8 +1094,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) {
@@ -1104,6 +1102,8 @@ static int python_start_script(const char *script, int argc, const char **argv)
goto error;
}
+ free(command_line);
+
return err;
error:
Py_Finalize();
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-05 8:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01 23:46 [PATCH] perf script: fix double free on command_line Colin King
2016-03-02 7:31 ` Jiri Olsa
2016-03-02 12:13 ` Arnaldo Carvalho de Melo
2016-03-05 8:18 ` [tip:perf/core] perf script: Fix " tip-bot for Colin Ian King
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.