Skip to content

Commit a3f7768

Browse files
captain5050acmel
authored andcommitted
perf annotate: Fix memory leak in annotated_source
Freeing hash map doesn't free the entries added to the hashmap, add the missing free(). Fixes: d3e7cad ("perf annotate: Add a hashmap for symbol histogram") Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Ben Gainey <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: K Prateek Nayak <[email protected]> Cc: Li Dong <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Paran Lee <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Sun Haiyong <[email protected]> Cc: Tim Chen <[email protected]> Cc: Yanteng Si <[email protected]> Cc: Yicong Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 769e6a1 commit a3f7768

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/perf/util/annotate.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,15 @@ static struct annotated_source *annotated_source__new(void)
107107

108108
static __maybe_unused void annotated_source__delete(struct annotated_source *src)
109109
{
110+
struct hashmap_entry *cur;
111+
size_t bkt;
112+
110113
if (src == NULL)
111114
return;
112115

116+
hashmap__for_each_entry(src->samples, cur, bkt)
117+
zfree(&cur->pvalue);
118+
113119
hashmap__free(src->samples);
114120
zfree(&src->histograms);
115121
free(src);

0 commit comments

Comments
 (0)