Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1347109 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2016-03-02 00:50 +0100 |
| Last post | 2016-03-02 13:20 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] perf script: fix double free on command_line Colin King <colin.king@canonical.com> - 2016-03-02 00:50 +0100
Re: [PATCH] perf script: fix double free on command_line Jiri Olsa <jolsa@redhat.com> - 2016-03-02 08:40 +0100
Re: [PATCH] perf script: fix double free on command_line Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-03-02 13:20 +0100
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2016-03-02 00:50 +0100 |
| Subject | [PATCH] perf script: fix double free on command_line |
| Message-ID | <r82dd-7Iy-9@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2016-03-02 08:40 +0100 |
| Message-ID | <r89y2-4qV-23@gated-at.bofh.it> |
| In reply to | #1347109 |
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
>
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-03-02 13:20 +0100 |
| Message-ID | <r8dV0-7rI-13@gated-at.bofh.it> |
| In reply to | #1347823 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web