Skip to content

Commit

Permalink
perf diff: Add missing hists__init() call at tool start
Browse files Browse the repository at this point in the history
It also uses hists/hist_entries, hists__init() should be called before
creating any evsels.

Otherwise no extra space will be allocated per perf_evsel nor this space
will be initialized when allocating a new perf_evsel instance, resulting
in reads/writes to non allocated space, oops. Fix it.

Signed-off-by: Kan Liang <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
kliang2 authored and acmel committed Oct 22, 2014
1 parent 3b10ea7 commit 9ab1f50
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/perf/builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,11 @@ static int data_init(int argc, const char **argv)

int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
{
int ret = hists__init();

if (ret < 0)
return ret;

perf_config(perf_default_config, NULL);

argc = parse_options(argc, argv, options, diff_usage, 0);
Expand Down

0 comments on commit 9ab1f50

Please sign in to comment.