From d0d3913895e5b50623bd4dafd876e41c1169031d Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Tue, 14 Aug 2012 10:57:03 +0900 Subject: perf script: Fix a NULL pointer dereference If 'perf script --gen-script' was called with a perf.data which contains no tracepoint event, it'd segfault due to NULL pevent pointer. Fix it. Signed-off-by: Namhyung Kim Cc: Feng Tang Cc: Ingo Molnar Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1344909423-26384-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/trace-event-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/perf/util/trace-event-parse.c') diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 4cb7f3831f7..a5a554efeb5 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c @@ -293,7 +293,7 @@ struct event_format *trace_find_next_event(struct pevent *pevent, { static int idx; - if (!pevent->events) + if (!pevent || !pevent->events) return NULL; if (!event) { -- cgit v1.2.3-18-g5258