Fix tests: NULL pointer dereference in ltt_session unit tests
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 10 Apr 2019 20:46:35 +0000 (16:46 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 10 Apr 2019 21:05:58 +0000 (17:05 -0400)
Skip the session destruction test if the target session is not
found. Otherwise, a NULL pointer dereference will occur.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/unit/test_session.c

index 991b1dca3de4e71d69d038bab9469bbef402af6c..cdb1bb88d7046cbe46218324db8031deddde00d1 100644 (file)
@@ -269,9 +269,13 @@ void test_destroy_session(void)
        ok(tmp != NULL,
           "Destroying session: session found");
 
-       ok(destroy_one_session(tmp) == 0,
-          "Destroying session: %s destroyed",
-          SESSION1);
+       if (tmp) {
+               ok(destroy_one_session(tmp) == 0,
+                  "Destroying session: %s destroyed",
+                  SESSION1);
+       } else {
+               skip(1, "Skipping session destruction as it was not found");
+       }
        session_unlock_list();
 }
 
This page took 0.034222 seconds and 4 git commands to generate.