summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/parse-events.y
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2019-11-08 23:58:40 -0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-11-12 08:34:16 -0300
commite1e9b78d3957a267346a86c8f2c433f6a332af65 (patch)
treeffdb9cc83a2c261da115d1f63dd3e67a7d08860d /tools/perf/util/parse-events.y
parentccd26741f5e6bdf2c18ea38b32e6a347c5648a97 (diff)
downloadlinux-e1e9b78d3957a267346a86c8f2c433f6a332af65.tar.gz
linux-e1e9b78d3957a267346a86c8f2c433f6a332af65.tar.xz
perf parse: Use YYABORT to clear stack after failure, plugging leaks
Using return rather than YYABORT means that the stack isn't cleared up following a failure. The change to YYABORT means the return value is 1 rather than -1, but the callers just check for a result of 0 (success). Add missing free of a list when an error occurs in event_pmu. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20191109075840.181231-1-irogers@google.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.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 4cac830015be..e2eea4e601b4 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -284,6 +284,7 @@ PE_NAME opt_pmu_config
do { \
parse_events_terms__delete($2); \
parse_events_terms__delete(orig_terms); \
+ free(list); \
free($1); \
free(pattern); \
YYABORT; \
@@ -550,7 +551,7 @@ tracepoint_name opt_event_config
free($1.event);
if (err) {
free(list);
- return -1;
+ YYABORT;
}
$$ = list;
}