aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <[email protected]>2021-08-20 14:13:36 +0000
committerArnaldo Carvalho de Melo <[email protected]>2021-08-30 13:06:22 +0000
commit261f491133aecb943ccfdc3b3794e2d775607a87 (patch)
treeb5e19a97e68bd5d2bf39e89a98e5138455749e79 /tools/perf/util/annotate.c
parentperf tools: Fixup get_current_dir_name() compilation (diff)
downloadkernel-261f491133aecb943ccfdc3b3794e2d775607a87.tar.gz
kernel-261f491133aecb943ccfdc3b3794e2d775607a87.zip
perf config: Fix caching and memory leak in perf_home_perfconfig()
Acaict, perf_home_perfconfig() is supposed to cache the result of home_perfconfig, which returns the default location of perfconfig for the user, given the HOME environment variable. However, the current implementation calls home_perfconfig every time perf_home_perfconfig() is called (so no caching is actually performed), replacing the previous pointer, thus also causing a memory leak. This patch adds a check of whether either config or failed is set and, in that case, directly returns config without calling home_perfconfig at each invocation. Fixes: f5f03e19ce14fc31 ("perf config: Add perf_home_perfconfig function") Signed-off-by: Riccardo Mancini <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Song Liu <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] [ Removed needless double check for the 'failed' variable ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/annotate.c')
0 files changed, 0 insertions, 0 deletions