aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/parse-events.l
diff options
context:
space:
mode:
authorGravatar Ian Rogers <irogers@google.com> 2023-06-13 11:26:29 -0700
committerGravatar Arnaldo Carvalho de Melo <acme@redhat.com> 2023-06-13 23:40:33 -0300
commit6ec9503f45740b6ae4cb7f3e7441b1539c6d51d6 (patch)
tree8781cdf44224fa99129cc8b68bc6a8d88aff0a3f /tools/perf/util/parse-events.l
parentperf metric: Fix no group check (diff)
downloadlinux-6ec9503f45740b6ae4cb7f3e7441b1539c6d51d6.tar.gz
linux-6ec9503f45740b6ae4cb7f3e7441b1539c6d51d6.tar.bz2
linux-6ec9503f45740b6ae4cb7f3e7441b1539c6d51d6.zip
perf parse-events: Avoid string for PE_BP_COLON, PE_BP_SLASH
There's no need to read the string ':' or '/' for PE_BP_COLON or PE_BP_SLASH and doing so causes parse-events.y to leak memory. The original patch has a committer note about not using these tokens presumably as yacc spotted they were a memory leak because no %destructor could be run. Remove the unused token workaround as there is now no value associated with these tokens. Fixes: f0617f526cb0c482 ("perf parse: Allow config terms with breakpoints") Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230613182629.1500317-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.l')
-rw-r--r--tools/perf/util/parse-events.l4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 7629af3d5c7c..99335ec586ae 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -315,13 +315,13 @@ r0x{num_raw_hex} { return str(yyscanner, PE_RAW); }
* are the same, so trailing context can be used disambiguate the two
* cases.
*/
-":"/{modifier_bp} { return str(yyscanner, PE_BP_COLON); }
+":"/{modifier_bp} { return PE_BP_COLON; }
/*
* The slash before memory length can get mixed up with the slash before
* config terms. Fortunately config terms do not start with a numeric
* digit, so trailing context can be used disambiguate the two cases.
*/
-"/"/{digit} { return str(yyscanner, PE_BP_SLASH); }
+"/"/{digit} { return PE_BP_SLASH; }
"/"/{non_digit} { BEGIN(config); return '/'; }
{num_dec} { return value(yyscanner, 10); }
{num_hex} { return value(yyscanner, 16); }