]> git.baikalelectronics.ru Git - kernel.git/commit
perf tools: Fix resource leak of closedir() on the error paths
authorYunfeng Ye <yeyunfeng@huawei.com>
Tue, 15 Oct 2019 08:30:08 +0000 (16:30 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 15 Oct 2019 14:54:11 +0000 (11:54 -0300)
commit56c2bf88ca4184d52de40504d8d0d45faa7aaab2
tree58aee842faae6efa54077e2545e0fda4b52290c6
parentf1dafbc79f28983cc42e5af0d2a49fe5c9e35e9d
perf tools: Fix resource leak of closedir() on the error paths

Both build_mem_topology() and rm_rf_depth_pat() have resource leaks of
closedir() on the error paths.

Fix this by calling closedir() before function returns.

Fixes: 412214bbed99 ("perf tools: Add MEM_TOPOLOGY feature to perf data file")
Fixes: b9cf72d15519 ("perf tools: Add pattern name checking to rm_rf")
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Feilong Lin <linfeilong@huawei.com>
Cc: Hu Shiyuan <hushiyuan@huawei.com>
Cc: Igor Lubashev <ilubashe@akamai.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Link: http://lore.kernel.org/lkml/cd5f7cd2-b80d-6add-20a1-32f4f43e0744@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/header.c
tools/perf/util/util.c