From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752165AbcCAXqn (ORCPT ); Tue, 1 Mar 2016 18:46:43 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:47426 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750850AbcCAXqm (ORCPT ); Tue, 1 Mar 2016 18:46:42 -0500 From: Colin King To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Adrian Hunter , Steven Rostedt , Javi Merino , He Kuang 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 Message-Id: <1456875980-25606-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 2.7.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King 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 --- 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