Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2995491pxb; Tue, 24 Aug 2021 12:27:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLQ1sKLL/HEKVc/ASHdCQ6n8Rfv9AVTKcvDLBe0L6mCXCd1LZSfpgIjuNHp4hA79LurocW X-Received: by 2002:a92:ca89:: with SMTP id t9mr28876527ilo.178.1629833276920; Tue, 24 Aug 2021 12:27:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629833276; cv=none; d=google.com; s=arc-20160816; b=Q9FfZfHOEE3nxELDLvNP6zatiRNKVRke5gz0W0EYxzStKSiCNDPTy5+uwPXmmZJxCR Phkx+LX5RkxSd+qBy1sD73Rz6fF1v9x+Xw06RVNd2tJGjZ16pQe2AM96Xr5NbDgu4Su4 5sYwSaBWjkOrf+S4JbvoFRtz4/WOZWdBVtI/jRTPsslXUV4+xMRQpf/peSfdMPfai4+G QOM56X8xpvqO25HrmOmt1zBnEObV/6yXWFUJIkc7nVaK0MoghPOr/LIIhbbxJojMj8QY YX07pqgLnAAL+YYdFeDQz5gqYdBTVHDQa9y/ss5wx956OFmVlb/bhrGxAsvv2GfkbSxu HfuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Nsa+P0ZpCAX1lQrdfxGkKkqjjTd8hLs/Lom6dO14RgE=; b=SU0J2gFqXBxpFtEJWBPrTWwSnOltVhPFEw5e09man4ON8Y5Fgp/jknulZy3aGZd/Jy UMKLyXxJSZvku9GhQ2ZpvUrNjgp5GG2W3XgqUFBhqL5W0wvBh43KBK1KvLSRnaj1KIXD qcrSbcodllXpFavFO3zHGoKp3g8rKzQ/b6ZIXcHJwlCTTnC3DFaU2T6nQvJBSBLa2n77 dbtUuJ5U5fYF1kWExxK3tvq3ZulE3ka/Lj/3OaW/JX8P1YZfS9QrQyVON8s1HjktGOaD etH2K0MFUhCAYA7SWSn2SuDY9ufgLY3Jj8oENyc/0R/m+sjxjapfqrATgXYGZ75kC800 oAFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U6JeatVO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si22787230ilh.18.2021.08.24.12.27.44; Tue, 24 Aug 2021 12:27:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U6JeatVO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234096AbhHXT13 (ORCPT + 99 others); Tue, 24 Aug 2021 15:27:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:60654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbhHXT12 (ORCPT ); Tue, 24 Aug 2021 15:27:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0A5D061002; Tue, 24 Aug 2021 19:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629833204; bh=WTppzCVYfXTRwTJffWzU7XL4rwBv7qiOi43vs1AhyC0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U6JeatVOpURubaxLFhfEc2oUDCSD5SYOmjTfPSrxNhzZsCKbd7szNhNa/y26DcRLT bJyCCQgdo7L9ROnrJMeTqAZwrlr93PWOyg5Rp2rJFqPmyp0aZk0zMTHszyNZoZaJMa sXPS1mGWKst4V5CTB4RzSQhNqnZPFh0hQMdEyb44kcdTXshuhXe045fgMkYE4ZXiuz GK9G9azaLFANBL46hPdF49ogY4LeGBfMfqxduJCiGHnkApKZLfGmInElocv4tdQCjp tVib0XuxteGxgCYhEXr77YWbWeD9HxJbr7UO+vL6Ia7b1nIjJ5uw+APg5iXV44K/gg kh7AbsU3yunzw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id E1E244007E; Tue, 24 Aug 2021 16:26:40 -0300 (-03) Date: Tue, 24 Aug 2021 16:26:40 -0300 From: Arnaldo Carvalho de Melo To: Riccardo Mancini Cc: Arnaldo Carvalho de Melo , Ian Rogers , Namhyung Kim , Jiri Olsa , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Jin Yao , Song Liu , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf config: fix caching and memory leak in perf_home_perfconfig Message-ID: References: <20210820130817.740536-1-rickyman7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Aug 20, 2021 at 09:58:16PM +0200, Riccardo Mancini escreveu: > On Fri, 2021-08-20 at 11:13 -0300, Arnaldo Carvalho de Melo wrote: > > diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c > > index 63d472b336de21d4..4fb5e90d7a57ae48 100644 > > --- a/tools/perf/util/config.c > > +++ b/tools/perf/util/config.c > > @@ -581,7 +581,10 @@ const char *perf_home_perfconfig(void) > > ????????static const char *config; > > ????????static bool failed; > > ? > > -???????config = failed ? NULL : home_perfconfig(); > > +???????if (failed || config) > > +???????????????return config; > > + > > +???????config = home_perfconfig(); > > ????????if (!config) > > ????????????????failed = true; > > ? > > Looks good to me. > Shall I resend it fixed? No need, I'll fix it and apply, thanks for checking! - Arnaldo