lkml.org 
[lkml]   [2021]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 20/20] perf util/probe-file: delete namelist on error in del_events
Em Thu, Jul 15, 2021 at 06:07:25PM +0200, Riccardo Mancini escreveu:
> ASan reports some memory leaks when running the perf test
> "42: BPF filter".
> This second leak is caused by a strlist not being dellocated on error
> inside probe_file__del_events.
>
> This patch adds a goto label before the deallocation and makes the error
> path jump to it.

Fixes: e7895e422e4da63d ("perf probe: Split del_perf_probe_events()")

Thanks, applied.

- Arnaldo


> Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
> ---
> tools/perf/util/probe-file.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
> index f9a6cbcd641501b8..3d50de3217d50ae1 100644
> --- a/tools/perf/util/probe-file.c
> +++ b/tools/perf/util/probe-file.c
> @@ -377,11 +377,11 @@ int probe_file__del_events(int fd, struct strfilter *filter)
>
> ret = probe_file__get_events(fd, filter, namelist);
> if (ret < 0)
> - return ret;
> + goto out;
>
> ret = probe_file__del_strlist(fd, namelist);
> +out:
> strlist__delete(namelist);
> -
> return ret;
> }
>
> --
> 2.31.1
>

--

- Arnaldo

\
 
 \ /
  Last update: 2021-07-15 22:43    [W:0.170 / U:0.932 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site