Fix tests: NULL pointer dereference in ltt_session unit tests
[lttng-tools.git] / tests / unit / test_session.c
index fa3e367d20b121f5a7da4dfbb8e73a041d483eaf..991b1dca3de4e71d69d038bab9469bbef402af6c 100644 (file)
@@ -243,13 +243,19 @@ void test_validate_session(void)
        ok(tmp != NULL,
           "Validating session: session found");
 
-       ok(tmp->kernel_session == NULL &&
-          strlen(tmp->name),
-          "Validating session: basic sanity check");
+       if (tmp) {
+               ok(tmp->kernel_session == NULL &&
+                  strlen(tmp->name),
+                  "Validating session: basic sanity check");
+       } else {
+               skip(1, "Skipping session validation check as session was not found");
+               goto end;
+       }
 
        session_lock(tmp);
        session_unlock(tmp);
        session_put(tmp);
+end:
        session_unlock_list();
 }
 
This page took 0.023592 seconds and 4 git commands to generate.