lkml.org 
[lkml]   [2016]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] perf script: fix double free on command_line
Date
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
\
 
 \ /
  Last update: 2016-03-02 01:21    [W:0.077 / U:5.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site