提交 979ac257 编写于 作者: C Colin Ian King 提交者: Arnaldo Carvalho de Melo

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: NColin Ian King <colin.king@canonical.com>
Acked-by: NJiri 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 67678793
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册