Skip to content

Commit d4b3eed

Browse files
Manciukicacmel
authored andcommitted
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. Fixes: 1455206 ("perf data: Add perf_data__(create_dir|close_dir) functions") Signed-off-by: Riccardo Mancini <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Zhen Lei <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent e0fa7ab commit d4b3eed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/util/data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
static void close_dir(struct perf_data_file *files, int nr)
2222
{
23-
while (--nr >= 1) {
23+
while (--nr >= 0) {
2424
close(files[nr].fd);
2525
zfree(&files[nr].path);
2626
}

0 commit comments

Comments
 (0)