]> git.baikalelectronics.ru Git - kernel.git/commit
perf jevents: Fix resource leak in process_mapfile() and main()
authorYunfeng Ye <yeyunfeng@huawei.com>
Wed, 16 Oct 2019 13:50:17 +0000 (21:50 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 6 Nov 2019 18:43:06 +0000 (15:43 -0300)
commitb690732fc83b8f6d8875238daf9ed95352f35e16
tree9caec57b76727df881407cad635e78b1df97c472
parent9b9f5444549c627020602c03d3abdd838449200f
perf jevents: Fix resource leak in process_mapfile() and main()

There are memory leaks and file descriptor resource leaks in
process_mapfile() and main().

Fix this by adding free(), fclose() and free_arch_std_events() on the
error paths.

Fixes: bf186fcc37e4 ("perf jevents: Program to convert JSON file")
Fixes: 2577891489e1 ("perf jevents: Make build fail on JSON parse error")
Fixes: 32ccb717bdc8 ("perf vendor events: Add support for arch standard events")
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Feilong Lin <linfeilong@huawei.com>
Cc: Hu Shiyuan <hushiyuan@huawei.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Luke Mujica <lukemujica@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zenghui Yu <yuzenghui@huawei.com>
Link: http://lore.kernel.org/lkml/d7907042-ec9c-2bef-25b4-810e14602f89@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/pmu-events/jevents.c