Re: [PATCH 2/2] perf script: delete evlist when deleting session
From: Ian Rogers <irogers@google.com>
Date: 2021-06-22 05:15:05
Also in:
lkml
From: Ian Rogers <irogers@google.com>
Date: 2021-06-22 05:15:05
Also in:
lkml
On Mon, Jun 21, 2021 at 4:44 PM Riccardo Mancini [off-list ref] wrote:
ASan reports a memory leak related to session->evlist never being deleted. The evlist member is not deleted in perf_session__delete, so it should be deleted separately. This patch adds the missing deletion in perf-script. Signed-off-by: Riccardo Mancini <redacted> --- tools/perf/builtin-script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 1280cbfad4db..635a1d9cfc88 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c@@ -3991,7 +3991,7 @@ int cmd_script(int argc, const char **argv) zfree(&script.ptime_range); } - evlist__free_stats(session->evlist);
Should this be removed?
+ evlist__delete(session->evlist);
If the perf session "owns" the evlist, would it be cleaner to add this to perf_session__delete? Thanks, Ian
perf_session__delete(session);
if (script_started)
--
2.31.1