7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnaldo Carvalho de Melo [ Upstream commit 39e0022c89abcdc1a811dfc0aeec2a2b9010b660 ] pyrf__parse_events() prints the entries parse_events_error__print() receives with the details of a failed parse, but returns without freeing them, leaking whatever parse_events_error__handle() allocated, so call parse_events_error__exit() on both paths, as the other parse_events() callers do. The perf test attr core PMU probe takes this failure path on machines without a core PMU, where the leak then happens on every test run. Fixes: f081defccd93 ("perf python: Add parse_events function") Reported-by: Sashiko Closes: https://lore.kernel.org/r/sashiko-outbox-173525@kernel.org Reviewed-by: Ian Rogers Tested-by: Ian Rogers Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/python.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index d8a842621cda0..c504b83be39fb 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -3469,10 +3469,12 @@ static PyObject *pyrf__parse_events(PyObject *self, PyObject *args) perf_evlist__set_maps(evlist__core(evlist), cpus, threads); if (parse_events(evlist, input, &err)) { parse_events_error__print(&err, input); + parse_events_error__exit(&err); PyErr_SetFromErrno(PyExc_OSError); evlist__put(evlist); return NULL; } + parse_events_error__exit(&err); result = pyrf_evlist__from_evlist(evlist); evlist__put(evlist); return result; -- 2.53.0