]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf header: Fix one memory leakage in process_bpf_btf()
authorZhongqiu Han <quic_zhonhan@quicinc.com>
Thu, 5 Dec 2024 08:44:58 +0000 (16:44 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 10 Dec 2024 19:59:32 +0000 (16:59 -0300)
commit875d22980a062521beed7b5df71fb13a1af15d83
treeb9cc3df4870c3feb5dfa1b9113d364816da4672c
parent7504a1c20eb799adcf028a34855c7d9f3dd99545
perf header: Fix one memory leakage in process_bpf_btf()

If __perf_env__insert_btf() returns false due to a duplicate btf node
insertion, the temporary node will leak. Add a check to ensure the memory
is freed if the function returns false.

Fixes: a70a1123174ab592 ("perf bpf: Save BTF information as headers to perf.data")
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Zhongqiu Han <quic_zhonhan@quicinc.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <song@kernel.org>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20241205084500.823660-2-quic_zhonhan@quicinc.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/header.c