Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754202AbbB0A6b (ORCPT ); Thu, 26 Feb 2015 19:58:31 -0500 Received: from mail7.hitachi.co.jp ([133.145.228.42]:47345 "EHLO mail7.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751422AbbB0A6a (ORCPT ); Thu, 26 Feb 2015 19:58:30 -0500 Message-ID: <54EFC12F.7010002@hitachi.com> Date: Fri, 27 Feb 2015 09:58:23 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo 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 References: <54EED47D.1010306@hitachi.com> <20150226082504.28125.74506.stgit@localhost.localdomain> <20150226144633.GD1079@kernel.org> In-Reply-To: <20150226144633.GD1079@kernel.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1310 Lines: 46 (2015/02/26 23:46), Arnaldo Carvalho de Melo wrote: > 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? Ah, right! Acked-by: Masami Hiramatsu Thank you, > > - 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; > } > -- Masami HIRAMATSU Software Platform Research Dept. Linux Technology Research Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu.pt@hitachi.com -- 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/