From c6795a46ffb3f62e9a4961a2be1de4a7e2ad7aa6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 24 Aug 2018 14:09:52 -0400 Subject: [PATCH] Tests: possible NULL dereference in rotation notification test MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported-by: Coverity Scan (1395166 Dereference after null check) Signed-off-by: Jérémie Galarneau --- tests/regression/tools/notification/rotation.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/regression/tools/notification/rotation.c b/tests/regression/tools/notification/rotation.c index c9f5de497..fb516f31f 100644 --- a/tests/regression/tools/notification/rotation.c +++ b/tests/regression/tools/notification/rotation.c @@ -322,10 +322,11 @@ int test_notification( location_status = lttng_trace_archive_location_local_get_absolute_path( location, &chunk_path); - ok(location_status == LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK, + ok(location_status == LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK && chunk_path, "Retrieved path from location returned by the session rotation completed notification"); diag("Chunk available at %s", chunk_path ? chunk_path : "NULL"); - ok(!strncmp(session->output_path, chunk_path, strlen(session->output_path)), + + ok(chunk_path && !strncmp(session->output_path, chunk_path, strlen(session->output_path)), "Returned path from location starts with the output path"); end: -- 2.34.1