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 <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Ben Gainey <ben.gainey@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: K Prateek Nayak <kprateek.nayak@amd.com> Cc: Li Dong <lidong@vivo.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: Paran Lee <p4ranlee@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Sun Haiyong <sunhaiyong@loongson.cn> Cc: Tim Chen <tim.c.chen@linux.intel.com> Cc: Yanteng Si <siyanteng@loongson.cn> Cc: Yicong Yang <yangyicong@hisilicon.com> Link: https://lore.kernel.org/r/20240507183545.1236093-3-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 769e6a1 commit a3f7768

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

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)