From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932555AbbBZOqm (ORCPT ); Thu, 26 Feb 2015 09:46:42 -0500 Received: from mail.kernel.org ([198.145.29.136]:39696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932280AbbBZOql (ORCPT ); Thu, 26 Feb 2015 09:46:41 -0500 Date: Thu, 26 Feb 2015 11:46:33 -0300 From: Arnaldo Carvalho de Melo To: Masami Hiramatsu Cc: Peter Zijlstra , namhyung@kernel.org, Naohiro Aota , Ingo Molnar , Linux Kernel Mailing List Subject: Re: [PATCH perf/core ] [BUGFIX] perf-probe: Fix get_real_path to free allocated memory in error path Message-ID: <20150226144633.GD1079@kernel.org> References: <54EED47D.1010306@hitachi.com> <20150226082504.28125.74506.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150226082504.28125.74506.stgit@localhost.localdomain> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Feb 26, 2015 at 05:25:04PM +0900, Masami Hiramatsu escreveu: > Fix get_real_path to free allocated memory when comp_dir > is used for complementing path and getting an error. While reviewing this patch I noticed this is needed, ack? - Arnaldo diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 4a93bf433344..9526cf37682e 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -533,7 +533,7 @@ static int get_real_path(const char *raw_path, const char *comp_dir, else { if (access(raw_path, R_OK) == 0) { *new_path = strdup(raw_path); - return 0; + return *new_path ? 0 : -ENOMEM; } else return -errno; }