[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210716141122.858082-1-rickyman7@gmail.com>
Date: Fri, 16 Jul 2021 16:11:20 +0200
From: Riccardo Mancini <rickyman7@...il.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Riccardo Mancini <rickyman7@...il.com>,
Jiri Olsa <jolsa@...nel.org>,
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@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH RESEND] perf data: close all files in close_dir
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.
Cc: Jiri Olsa <jolsa@...nel.org>
Fixes: 145520631130bd64 ("perf data: Add perf_data__(create_dir|close_dir) functions")
Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
Acked-by: Namhyung Kim <namhyung@...nel.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
Powered by blists - more mailing lists