From: Jérémie Galarneau Date: Wed, 10 Apr 2019 20:46:35 +0000 (-0400) Subject: Fix tests: NULL pointer dereference in ltt_session unit tests X-Git-Tag: v2.11.0-rc2~29 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ce81af92ba734c459330c41ceed6904ab8258233;p=lttng-tools.git Fix tests: NULL pointer dereference in ltt_session unit tests 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 --- 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(); }