perf annotate: Fix segfault on sample histogram
authorNamhyung Kim <namhyung@kernel.org>
Fri, 10 May 2024 21:04:51 +0000 (14:04 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 11 May 2024 16:03:13 +0000 (13:03 -0300)
commit9ef30265a483f0405e4f7b3f15cda251b9a2c7da
tree635f98127b16db9ece0e2b96b963a4ea3845fc06
parent09541603462c399c7408d50295db99b4b8042eaa
perf annotate: Fix segfault on sample histogram

A symbol can have no samples, then accessing the annotated_source->samples
hashmap will result in a segfault.

Fixes: a3f7768bcf48281d ("perf annotate: Fix memory leak in annotated_source")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240510210452.2449944-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate.c