Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1429503pxb; Fri, 20 Aug 2021 05:33:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvf0FVzHd/Ap5YcmWTXPsEwM0AnuaZpDYi8bgWBf9qJhTGH4l8RuNxppJtiQIzPUY+ZRX3 X-Received: by 2002:a05:6402:1747:: with SMTP id v7mr22955677edx.19.1629462793836; Fri, 20 Aug 2021 05:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629462793; cv=none; d=google.com; s=arc-20160816; b=XJefCMk02RPwZ5VQq+ddBJiQawUeZSojVJPn+Hha1SY4iUmQbiUfTv0Ub8cT1rPECW Z9cYiLwroMbdVNgvSdunOh83r6f4SycdTP/3WnrxNRWVe6zd0/l3JhdZeLsL5esIVPay CQtF4eOYuTfhDdo0o2i7WyEMJOrTBk5AJ5LKy+RszXj6LdL4XSYC8wbBM2UnYnEaiuPf 0ja8BcJspGBiPI0vNds/sddbfpvB3s1SzQQho0DWk8u7NsyabRzR/yAqF27YH0dtmW6Q 9pKvXLI+v2jwhC6uZq3AkHo77o6RYKcRqRSqP85ppffRJuuR2F2npxW6UQfxLGBkWR0p Gxlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject; bh=Lfbs4e8sZW9UZd1sg7kE8TIfrMQTd7NJF9z+4s+O2NY=; b=iGzNFy2be6LqEcugmfQ8Xpwa1tsQ+g6WGGRIqEPHR44l0lhVqXamzJO52i5nOl5CRU Rr1zQj/ZfEOKO14Nny+hakX8oSFQTbtiHqbXgtC9FN9OOZrqbEJvAQZYGz+hJmg0JTVm +ww4Uo2gHd3Z1FfXGP3GKHlXJHh6ldLag08nuAhklKs3/g6NSPQXQ1x3VJlWsKGv54Rf S87FELSlM6oxIeZAiEgTu9PlxRDNWuh9YHZwSpQ26kVvZ4Gx+4UfbsPZTTFzDl1u0hAB 5Od2a+PiGx04bkOKbYGJQrEoUrTAlrN9CgoIVkqebCkUg1plxTP6Pf1Z06KZk6wHaTov zUIA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg4si259414ejc.285.2021.08.20.05.32.35; Fri, 20 Aug 2021 05:33:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240329AbhHTM3s (ORCPT + 99 others); Fri, 20 Aug 2021 08:29:48 -0400 Received: from mga03.intel.com ([134.134.136.65]:31979 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240262AbhHTM3q (ORCPT ); Fri, 20 Aug 2021 08:29:46 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10081"; a="216799037" X-IronPort-AV: E=Sophos;i="5.84,337,1620716400"; d="scan'208";a="216799037" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2021 05:29:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,337,1620716400"; d="scan'208";a="680077110" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.174]) ([10.237.72.174]) by fmsmga006.fm.intel.com with ESMTP; 20 Aug 2021 05:29:03 -0700 Subject: Re: [PATCH] perf tests: dlfilter: free desc and long_desc in check_filter_desc To: Riccardo Mancini , Arnaldo Carvalho de Melo Cc: Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210820113132.724034-1-rickyman7@gmail.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <1c426e33-d918-23d4-59ca-b96071491933@intel.com> Date: Fri, 20 Aug 2021 15:29:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210820113132.724034-1-rickyman7@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/08/21 2:31 pm, Riccardo Mancini wrote: > In dlfilter-test, the function check_filter_desc calls get_filter_desc > which allocates desc and long_desc. > However, these variables are never deallocated. > > This patch adds the missing frees. > > Cc: Adrian Hunter > Fixes: 9f9c9a8de2d5e96c ("perf tests: Add dlfilter test") > Signed-off-by: Riccardo Mancini Acked-by: Adrian Hunter > --- > tools/perf/tests/dlfilter-test.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/tests/dlfilter-test.c b/tools/perf/tests/dlfilter-test.c > index 7eba7955d53154e1..bc03b5df6828d6fa 100644 > --- a/tools/perf/tests/dlfilter-test.c > +++ b/tools/perf/tests/dlfilter-test.c > @@ -239,15 +239,20 @@ static int get_dlfilters_path(char *buf, size_t sz) > > static int check_filter_desc(struct test_data *td) > { > - char *long_desc; > - char *desc; > + char *long_desc = NULL; > + char *desc = NULL; > + int ret; > > if (get_filter_desc(td->dlfilters, "dlfilter-test-api-v0.so", &desc, &long_desc) && > long_desc && !strcmp(long_desc, "Filter used by the 'dlfilter C API' perf test") && > desc && !strcmp(desc, "dlfilter to test v0 C API")) > - return 0; > + ret = 0; > + else > + ret = -1; > > - return -1; > + free(desc); > + free(long_desc); > + return ret; > } > > static int get_ip_addr(struct test_data *td) >