Skip to content

Commit 9b86c49

Browse files
Yang Jihongacmel
authored andcommitted
perf tracepoint: Fix memory leak in is_valid_tracepoint()
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 <yangjihong1@huawei.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20230421025953.173826-1-yangjihong1@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 6bf86ca commit 9b86c49

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/util/tracepoint.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ int is_valid_tracepoint(const char *event_string)
5050
sys_dirent->d_name, evt_dirent->d_name);
5151
if (!strcmp(evt_path, event_string)) {
5252
closedir(evt_dir);
53+
put_events_file(dir_path);
5354
closedir(sys_dir);
5455
return 1;
5556
}

0 commit comments

Comments
 (0)