From d62d77fd18cc82e839e49b7ef3360e4411f7d2e5 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Tue, 17 Nov 2009 12:29:38 +0100 Subject: [PATCH] perf annotate: Allocate history size correctly Symbol offset history table size does not get updated properly when it is being resized. This leads to garbage results in perf annotate. Signed-off-by: Nick Piggin Cc: Peter Zijlstra Cc: Paul Mackerras Cc: Frederic Weisbecker Cc: Arnaldo Carvalho de Melo Cc: Mike Galbraith LKML-Reference: Signed-off-by: Ingo Molnar --- tools/perf/util/symbol.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 226f44a2357d..cbac57549298 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -227,6 +227,10 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int v) *curr = rb_entry(nd, struct symbol, rb_node); prev->end = curr->start - 1; + if (prev->hist) { + free(prev->hist); + prev->hist = calloc(sizeof(u64), prev->end - prev->start); + } prevnd = nd; } @@ -883,6 +887,10 @@ static inline void dso__fill_symbol_holes(struct dso *self) pos->end = prev->end; else if (hole) pos->end = prev->start - 1; + if (pos->hist) { + free(pos->hist); + pos->hist = calloc(sizeof(u64), pos->end - pos->start); + } } } prev = pos; -- 2.30.2