Skip to content

Commit e1e9b78

Browse files
captain5050acmel
authored andcommitted
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 <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent ccd2674 commit e1e9b78

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/perf/util/parse-events.y

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ PE_NAME opt_pmu_config
284284
do { \
285285
parse_events_terms__delete($2); \
286286
parse_events_terms__delete(orig_terms); \
287+
free(list); \
287288
free($1); \
288289
free(pattern); \
289290
YYABORT; \
@@ -550,7 +551,7 @@ tracepoint_name opt_event_config
550551
free($1.event);
551552
if (err) {
552553
free(list);
553-
return -1;
554+
YYABORT;
554555
}
555556
$$ = list;
556557
}

0 commit comments

Comments
 (0)