diff options
author | Colin Ian King <colin.king@canonical.com> | 2016-03-01 18:46:20 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-03 09:10:37 -0500 |
commit | 979ac257b00c53aacec3eacf86142e8c00bee889 (patch) | |
tree | f640a1f3e9d0a51c56bec2f79bd684fad86e4ebb /tools/perf/util/scripting-engines/trace-event-python.c | |
parent | 676787939ef8ccfcf8039104f766ebe5ebe23924 (diff) |
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>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 4 |
1 files 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 309d90fa7698..fbd05242b4e5 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) | |||
1094 | goto error; | 1094 | goto error; |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | free(command_line); | ||
1098 | |||
1099 | set_table_handlers(tables); | 1097 | set_table_handlers(tables); |
1100 | 1098 | ||
1101 | if (tables->db_export_mode) { | 1099 | if (tables->db_export_mode) { |
@@ -1104,6 +1102,8 @@ static int python_start_script(const char *script, int argc, const char **argv) | |||
1104 | goto error; | 1102 | goto error; |
1105 | } | 1103 | } |
1106 | 1104 | ||
1105 | free(command_line); | ||
1106 | |||
1107 | return err; | 1107 | return err; |
1108 | error: | 1108 | error: |
1109 | Py_Finalize(); | 1109 | Py_Finalize(); |