[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7cgwTqDov1bD8FKygKkxeOY=tys8_DP3qytCmgne35BOcA@mail.gmail.com>
Date: Tue, 22 Jun 2021 12:52:51 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Riccardo Mancini <rickyman7@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Zhen Lei <thunder.leizhen@...wei.com>,
linux-perf-users <linux-perf-users@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf data: close all files in close_dir
On Mon, Jun 21, 2021 at 2:42 PM Riccardo Mancini <rickyman7@...il.com> wrote:
>
> 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.
>
> Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
Acked-by: Namhyung Kim <namhyung@...nel.org>
Thanks,
Namhyung
> ---
> 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 8fca4779ae6a..70b91ce35178 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
>
Powered by blists - more mailing lists