summaryrefslogtreecommitdiff
path: root/tools/perf/util/parse-events.y
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2015-05-19 16:05:44 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-05-27 12:21:43 -0300
commita6ced2be06c302402c52dedba97d169d22cce99c (patch)
treee03776dd304df329ea7f376028e7a44bf38f6796 /tools/perf/util/parse-events.y
parentbb78ce7d0598fb277290f8ee2443b8f4e0eb7cb2 (diff)
perf tools: Fix parse_events_error dereferences
Parse errors can be reported in struct parse_events_error but the pointer passed is optional and can be NULL. Ensure it is not NULL before dereferencing it. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Link: http://lkml.kernel.org/r/1432040746-1755-4-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.y')
-rw-r--r--tools/perf/util/parse-events.y6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 3d11e00243e3..591905a02b92 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -389,8 +389,10 @@ PE_NAME ':' PE_NAME
if (parse_events_add_tracepoint(list, &data->idx, $1, $3)) {
struct parse_events_error *error = data->error;
- error->idx = @1.first_column;
- error->str = strdup("unknown tracepoint");
+ if (error) {
+ error->idx = @1.first_column;
+ error->str = strdup("unknown tracepoint");
+ }
return -1;
}
$$ = list;