From: Colin King <colin.king@canonical.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Steven Rostedt <rostedt@goodmis.org>,
Javi Merino <javi.merino@arm.com>, He Kuang <hekuang@huawei.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] perf script: fix double free on command_line
Date: Tue, 1 Mar 2016 23:46:20 +0000 [thread overview]
Message-ID: <1456875980-25606-1-git-send-email-colin.king@canonical.com> (raw)
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
next reply other threads:[~2016-03-01 23:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 23:46 Colin King [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456875980-25606-1-git-send-email-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=hekuang@huawei.com \
--cc=javi.merino@arm.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®