All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Riccardo Mancini <rickyman7@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@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>,
	Zhen Lei <thunder.leizhen@huawei.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] perf data: close all files in close_dir
Date: Fri, 16 Jul 2021 16:01:59 -0300	[thread overview]
Message-ID: <YPHXp2yGpdiBDCA/@kernel.org> (raw)
In-Reply-To: <20210716141122.858082-1-rickyman7@gmail.com>

Em Fri, Jul 16, 2021 at 04:11:20PM +0200, Riccardo Mancini escreveu:
> When using perf report in directory mode, the first file is not closed on
> exit, causing a memory leak.
> The problem is caused by the iterating variable never reaching 0.

Thanks, applied.

- Arnaldo
 
> Cc: Jiri Olsa <jolsa@kernel.org>
> Fixes: 145520631130bd64 ("perf data: Add perf_data__(create_dir|close_dir) functions")
> Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
> ---
> Hi Arnaldo, 
> 
> I think this patch might have gone lost in the mailbox, submerged by
> other mails.
> I'll take advantage of the resend to add the missing 'Fixes:' tag.
> 
> I didn't flag this as v2 since it contains no logical change, let me
> know if doing so would've been better.
> 
> Changes from first send: 
>  - collected ack from Namhyung
>  - added Fixes: tag
> 
> Original: https://lkml.kernel.org/lkml/20210621214220.167927-1-rickyman7@gmail.com/
> 
> Thanks,
> Riccardo
> ---
>  tools/perf/util/data.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
> index 8fca4779ae6a8e90..70b91ce35178c5f9 100644
> --- a/tools/perf/util/data.c
> +++ b/tools/perf/util/data.c
> @@ -20,7 +20,7 @@
>  
>  static void close_dir(struct perf_data_file *files, int nr)
>  {
> -	while (--nr >= 1) {
> +	while (--nr >= 0) {
>  		close(files[nr].fd);
>  		zfree(&files[nr].path);
>  	}
> -- 
> 2.23.0
> 

-- 

- Arnaldo

      reply	other threads:[~2021-07-16 19:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 14:11 [PATCH RESEND] perf data: close all files in close_dir Riccardo Mancini
2021-07-16 19:01 ` Arnaldo Carvalho de Melo [this message]

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=YPHXp2yGpdiBDCA/@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --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 \
    --cc=thunder.leizhen@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.