[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YPCZoa/IwENjYPe5@kernel.org>
Date: Thu, 15 Jul 2021 17:25:05 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Riccardo Mancini <rickyman7@...il.com>
Cc: Ian Rogers <irogers@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 13/20] perf script: fix memory leaks in perf_script
Em Thu, Jul 15, 2021 at 06:07:18PM +0200, Riccardo Mancini escreveu:
> ASan reports several memory leaks while running the perf test
> "82: Use vfs_getname probe to get syscall args filenames".
> Two of these are caused by some refcounts not being decreased on
> perf-script exit, namely script.threads and script.cpus.
>
> This patch adds the missing __put calls in a new perf_script__exit
> function, which is called at the end of cmd_script.
>
> This patch concludes the fixes of all remaining memory leaks in perf
> test "82: Use vfs_getname probe to get syscall args filenames".
Fixes: cfc8874a48599249 ("perf script: Process cpu/threads maps")
Thanks, applied.
- Arnaldo
> Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
> ---
> tools/perf/builtin-script.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index bae0e5b72c0e6050..064da7f3618d39d8 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -2601,6 +2601,12 @@ static void perf_script__exit_per_event_dump_stats(struct perf_script *script)
> }
> }
>
> +static void perf_script__exit(struct perf_script *script)
> +{
> + perf_thread_map__put(script->threads);
> + perf_cpu_map__put(script->cpus);
> +}
> +
> static int __cmd_script(struct perf_script *script)
> {
> int ret;
> @@ -4146,6 +4152,7 @@ int cmd_script(int argc, const char **argv)
> zstd_fini(&(session->zstd_data));
> evlist__free_stats(session->evlist);
> perf_session__delete(session);
> + perf_script__exit(&script);
>
> if (script_started)
> cleanup_scripting();
> --
> 2.31.1
>
--
- Arnaldo
Powered by blists - more mailing lists