Skip to content

Commit

Permalink
perf tracepoint: Fix memory leak in is_valid_tracepoint()
Browse files Browse the repository at this point in the history
When is_valid_tracepoint() returns 1, need to call put_events_file() to
free `dir_path`.

Fixes: 25a7d91 ("perf parse-events: Use get/put_events_file()")
Signed-off-by: Yang Jihong <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
Yang Jihong authored and acmel committed May 2, 2023
1 parent 6bf86ca commit 9b86c49
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/perf/util/tracepoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ int is_valid_tracepoint(const char *event_string)
sys_dirent->d_name, evt_dirent->d_name);
if (!strcmp(evt_path, event_string)) {
closedir(evt_dir);
put_events_file(dir_path);
closedir(sys_dir);
return 1;
}
Expand Down

0 comments on commit 9b86c49

Please sign in to comment.