mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
perf tools: Fix resources leak in perf_data__open_dir()
[ Upstream commit0a6564ebd9
] In perf_data__open_dir(), opendir() opens the directory stream. Add missing closedir() to release it after use. Fixes:eb6176709b
("perf data: Add perf_data__open_dir_data function") Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20221229090903.1402395-1-linmq006@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
466655ddac
commit
2bb8016d4b
1 changed files with 2 additions and 0 deletions
|
@ -132,6 +132,7 @@ int perf_data__open_dir(struct perf_data *data)
|
|||
file->size = st.st_size;
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
if (!files)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -140,6 +141,7 @@ int perf_data__open_dir(struct perf_data *data)
|
|||
return 0;
|
||||
|
||||
out_err:
|
||||
closedir(dir);
|
||||
close_dir(files, nr);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue