From acd4994ea8be231df5caecefd580bad358ce16e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 10 Apr 2019 16:46:35 -0400 Subject: [PATCH] Fix tests: NULL pointer dereference in ltt_session unit tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- tests/unit/test_session.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_session.c b/tests/unit/test_session.c index 991b1dca3..cdb1bb88d 100644 --- a/tests/unit/test_session.c +++ b/tests/unit/test_session.c @@ -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(); } -- 2.34.1