2021-07-15 16:54:48

by Riccardo Mancini

[permalink] [raw]
Subject: [PATCH 11/20] perf session: cleanup trace_event

ASan reports several memory leaks when running the perf test
"82: Use vfs_getname probe to get syscall args filenames", many of which
are related to session->tevent.
This patch will solve this problem, then next patch will fix the remaining
memory leaks in perf-script.
This bug is due to a missing deallocation of the trace_event data
strutures.

This patch adds the missing trace_event__cleanup in
perf_session__delete.

Signed-off-by: Riccardo Mancini <[email protected]>
---
tools/perf/util/session.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index e9c929a39973ace9..51f72740291267c5 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -306,6 +306,7 @@ void perf_session__delete(struct perf_session *session)
evlist__delete(session->evlist);
perf_data__close(session->data);
}
+ trace_event__cleanup(&session->tevent);
free(session);
}

--
2.31.1


2021-07-15 20:23:14

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH 11/20] perf session: cleanup trace_event

Em Thu, Jul 15, 2021 at 06:07:16PM +0200, Riccardo Mancini escreveu:
> ASan reports several memory leaks when running the perf test
> "82: Use vfs_getname probe to get syscall args filenames", many of which
> are related to session->tevent.
> This patch will solve this problem, then next patch will fix the remaining
> memory leaks in perf-script.
> This bug is due to a missing deallocation of the trace_event data
> strutures.
>
> This patch adds the missing trace_event__cleanup in
> perf_session__delete.

Thanks, applied.

- Arnaldo


> Signed-off-by: Riccardo Mancini <[email protected]>
> ---
> tools/perf/util/session.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index e9c929a39973ace9..51f72740291267c5 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -306,6 +306,7 @@ void perf_session__delete(struct perf_session *session)
> evlist__delete(session->evlist);
> perf_data__close(session->data);
> }
> + trace_event__cleanup(&session->tevent);
> free(session);
> }
>
> --
> 2.31.1
>

--

- Arnaldo