Skip to content

Commit ed0bdfe

Browse files
Manciukicgregkh
authored andcommitted
perf probe-file: Delete namelist in del_events() on the error path
[ Upstream commit e0fa7ab ] ASan reports some memory leaks when running: # 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. Signed-off-by: Riccardo Mancini <rickyman7@gmail.com> Fixes: e7895e4 ("perf probe: Split del_perf_probe_events()") Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/174963c587ae77fa108af794669998e4ae558338.1626343282.git.rickyman7@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 871c704 commit ed0bdfe

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎tools/perf/util/probe-file.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,11 @@ int probe_file__del_events(int fd, struct strfilter *filter)
342342

343343
ret = probe_file__get_events(fd, filter, namelist);
344344
if (ret < 0)
345-
return ret;
345+
goto out;
346346

347347
ret = probe_file__del_strlist(fd, namelist);
348+
out:
348349
strlist__delete(namelist);
349-
350350
return ret;
351351
}
352352

0 commit comments

Comments
 (0)