aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2023-10-09 11:39:18 -0700
committerNamhyung Kim <[email protected]>2023-10-12 10:01:57 -0700
commit97fe038374bdf43fd025ac0e7aebf8bfbdd6d54f (patch)
tree5528b486ab4e61879a00083f6f95ffeebafa5b0c
parentc4b5140c6eac2f757d9706c6c783b60554c48cb7 (diff)
perf trace-event-info: Avoid passing NULL value to closedir
If opendir failed then closedir was passed NULL which is erroneous. Caught by clang-tidy. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Yang Jihong <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Kan Liang <[email protected]> Cc: [email protected] Cc: Ming Wang <[email protected]> Cc: Tom Rix <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
-rw-r--r--tools/perf/util/trace-event-info.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 319ccf09a435..c8755679281e 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -313,7 +313,8 @@ static int record_event_files(struct tracepoint_path *tps)
}
err = 0;
out:
- closedir(dir);
+ if (dir)
+ closedir(dir);
put_tracing_file(path);
return err;