Thread (6 messages) 6 messages, 4 authors, 2021-07-01

Re: [PATCH v2] perf session: add missing evlist__delete when deleting a session

From: Arnaldo Carvalho de Melo <acme@kernel.org>
Date: 2021-07-01 18:05:05
Also in: lkml

Em Fri, Jun 25, 2021 at 01:54:03PM +0200, Jiri Olsa escreveu:
On Thu, Jun 24, 2021 at 10:39:34PM -0700, Ian Rogers wrote:
quoted
On Thu, Jun 24, 2021 at 4:20 PM Riccardo Mancini [off-list ref] wrote:
quoted
ASan reports a memory leak caused by evlist not being deleted on exit in
perf-report, perf-script and perf-data.
The problem is caused by evlist->session not being deleted, which is
allocated in perf_session__read_header, called in perf_session__new if
perf_data is in read mode.
In case of write mode, the session->evlist is filled by the caller.
This patch solves the problem by calling evlist__delete in
perf_session__delete if perf_data is in read mode.
ugh, I'm surprised we did not free that.. and can't find
in git log we ever did ;-) I briefly check commands using
sessions and looks like it's correct

Acked-by: Jiri Olsa <redacted>
quoted
Acked-by: Ian Rogers <irogers@google.com>

It is messy that in read mode the session owns the evlist, but
otherwise not. Imo, it'd be nice to make the ownership unconditional.
yep, would be nice
Thanks, applied.

Riccardo, next time please consider adding a Fixes: tag so that the
stable@kernel.org guys can pick this for stable releases.

- Arnaldo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help