[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YPCbCfXujLOiEDkz@kernel.org>
Date: Thu, 15 Jul 2021 17:31: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 14/20] perf util/lzma: close lzma stream
Em Thu, Jul 15, 2021 at 06:07:19PM +0200, Riccardo Mancini escreveu:
> ASan reports memory leaks when running the perf test
> "88: Check open filename arg using perf trace + vfs_getname".
> One of these is caused by the lzma stream never being closed inside
> lzma_decompress_to_file.
>
> This patch adds the missing lzma_end.
Fixes: 80a32e5b498a7547 ("perf tools: Add lzma decompression support for kernel module")
Thanks, applied.
- Arnaldo
> Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
> ---
> tools/perf/util/lzma.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/lzma.c b/tools/perf/util/lzma.c
> index 39062df0262915bd..51424cdc3b682c64 100644
> --- a/tools/perf/util/lzma.c
> +++ b/tools/perf/util/lzma.c
> @@ -69,7 +69,7 @@ int lzma_decompress_to_file(const char *input, int output_fd)
>
> if (ferror(infile)) {
> pr_err("lzma: read error: %s\n", strerror(errno));
> - goto err_fclose;
> + goto err_lzma_end;
> }
>
> if (feof(infile))
> @@ -83,7 +83,7 @@ int lzma_decompress_to_file(const char *input, int output_fd)
>
> if (writen(output_fd, buf_out, write_size) != write_size) {
> pr_err("lzma: write error: %s\n", strerror(errno));
> - goto err_fclose;
> + goto err_lzma_end;
> }
>
> strm.next_out = buf_out;
> @@ -95,11 +95,13 @@ int lzma_decompress_to_file(const char *input, int output_fd)
> break;
>
> pr_err("lzma: failed %s\n", lzma_strerror(ret));
> - goto err_fclose;
> + goto err_lzma_end;
> }
> }
>
> err = 0;
> +err_lzma_end:
> + lzma_end(&strm);
> err_fclose:
> fclose(infile);
> return err;
> --
> 2.31.1
>
--
- Arnaldo
Powered by blists - more mailing lists