mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Riccardo Mancini <rickyman7@gmail.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf tests: dlfilter: free desc and long_desc in check_filter_desc
Date: Fri, 20 Aug 2021 15:29:39 +0300	[thread overview]
Message-ID: <1c426e33-d918-23d4-59ca-b96071491933@intel.com> (raw)
In-Reply-To: <20210820113132.724034-1-rickyman7@gmail.com>

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 <adrian.hunter@intel.com>
> Fixes: 9f9c9a8de2d5e96c ("perf tests: Add dlfilter test")
> Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  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)
> 


  reply	other threads:[~2021-08-20 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 11:31 Riccardo Mancini
2021-08-20 12:29 ` Adrian Hunter [this message]
2021-08-20 14:17   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c426e33-d918-23d4-59ca-b96071491933@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rickyman7@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®