Skip to content

Commit e0fa7ab

Browse files
Manciukicacmel
authored andcommitted
perf probe-file: Delete namelist in del_events() on the error path
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 <[email protected]> Fixes: e7895e4 ("perf probe: Split del_perf_probe_events()") Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/174963c587ae77fa108af794669998e4ae558338.1626343282.git.rickyman7@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 937654c commit e0fa7ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/perf/util/probe-file.c

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

378378
ret = probe_file__get_events(fd, filter, namelist);
379379
if (ret < 0)
380-
return ret;
380+
goto out;
381381

382382
ret = probe_file__del_strlist(fd, namelist);
383+
out:
383384
strlist__delete(namelist);
384-
385385
return ret;
386386
}
387387

0 commit comments

Comments
 (0)