Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932264AbbBZI0K (ORCPT ); Thu, 26 Feb 2015 03:26:10 -0500 Received: from mail7.hitachi.co.jp ([133.145.228.42]:53316 "EHLO mail7.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753590AbbBZI0G (ORCPT ); Thu, 26 Feb 2015 03:26:06 -0500 X-AuditID: 85900ec0-a18c6b90000043ee-59-54eed86449fa Subject: [PATCH perf/core ] [BUGFIX] perf-probe: Fix get_real_path to free allocated memory in error path From: Masami Hiramatsu To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , namhyung@kernel.org, Naohiro Aota , Ingo Molnar , Linux Kernel Mailing List Date: Thu, 26 Feb 2015 17:25:04 +0900 Message-ID: <20150226082504.28125.74506.stgit@localhost.localdomain> In-Reply-To: <54EED47D.1010306@hitachi.com> References: <54EED47D.1010306@hitachi.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1053 Lines: 31 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 --- 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 9dfbed9..43cc534 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/