]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - tools/perf/util/session.c
perf session: Fix possible null pointer dereference in session.c
[karo-tx-linux.git] / tools / perf / util / session.c
index 55960f22233c4c994feff352d2e458113a4f1db4..64a186edc7be82e006f22de95e2d40b51bd4e29d 100644 (file)
@@ -1625,13 +1625,14 @@ out_delete_map:
 void perf_session__fprintf_info(struct perf_session *session, FILE *fp,
                                bool full)
 {
-       int fd = perf_data_file__fd(session->file);
        struct stat st;
-       int ret;
+       int fd, ret;
 
        if (session == NULL || fp == NULL)
                return;
 
+       fd = perf_data_file__fd(session->file);
+
        ret = fstat(fd, &st);
        if (ret == -1)
                return;