Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751105AbbB1Jhz (ORCPT ); Sat, 28 Feb 2015 04:37:55 -0500 Received: from terminus.zytor.com ([198.137.202.10]:45028 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588AbbB1JcQ (ORCPT ); Sat, 28 Feb 2015 04:32:16 -0500 Date: Sat, 28 Feb 2015 01:31:08 -0800 From: tip-bot for Masami Hiramatsu Message-ID: Cc: linux-kernel@vger.kernel.org, masami.hiramatsu.pt@hitachi.com, mingo@kernel.org, naota@elisp.net, tglx@linutronix.de, acme@redhat.com, peterz@infradead.org, hpa@zytor.com, namhyung@kernel.org Reply-To: namhyung@kernel.org, naota@elisp.net, acme@redhat.com, tglx@linutronix.de, hpa@zytor.com, peterz@infradead.org, mingo@kernel.org, masami.hiramatsu.pt@hitachi.com, linux-kernel@vger.kernel.org In-Reply-To: <20150226082504.28125.74506.stgit@localhost.localdomain> References: <20150226082504.28125.74506.stgit@localhost.localdomain> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Fix get_real_path to free allocated memory in error path Git-Commit-ID: eb47cb2eb22dfacac9689708f5bd3cb0e975e290 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1718 Lines: 44 Commit-ID: eb47cb2eb22dfacac9689708f5bd3cb0e975e290 Gitweb: http://git.kernel.org/tip/eb47cb2eb22dfacac9689708f5bd3cb0e975e290 Author: Masami Hiramatsu AuthorDate: Thu, 26 Feb 2015 17:25:04 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 26 Feb 2015 11:59:05 -0300 perf probe: Fix get_real_path to free allocated memory in error path Fix get_real_path to free allocated memory when comp_dir is used for complementing path and getting an error. Signed-off-by: Masami Hiramatsu Cc: Namhyung Kim Cc: Naohiro Aota Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20150226082504.28125.74506.stgit@localhost.localdomain Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/probe-event.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 662d454..4a93bf4 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -549,9 +549,11 @@ static int get_real_path(const char *raw_path, const char *comp_dir, if (access(*new_path, R_OK) == 0) return 0; - if (!symbol_conf.source_prefix) + if (!symbol_conf.source_prefix) { /* In case of searching comp_dir, don't retry */ + zfree(new_path); return -errno; + } switch (errno) { case ENAMETOOLONG: -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/