Thread (50 messages) 50 messages, 3 authors, 2022-01-06

Re: [PATCH 20/20] perf util/probe-file: delete namelist on error in del_events

From: Arnaldo Carvalho de Melo <acme@kernel.org>
Date: 2021-07-15 20:41:35
Also in: lkml

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

 
quoted hunk ↗ jump to hunk
Signed-off-by: Riccardo Mancini <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help