diff mbox series

[2/3] libtracefs: Avoid null access

Message ID 20220224234823.1190425-2-irogers@google.com (mailing list archive)
State Accepted
Commit c86872fe05300766f6b252b4795f184cb4fde664
Headers show
Series [1/3] libtracefs: Fix spelling in test name | expand

Commit Message

Ian Rogers Feb. 24, 2022, 11:48 p.m. UTC
The for loop handles devents == NULL, but the test afterwards needs to
also.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 utest/tracefs-utest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 5163004..7042fa9 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -433,7 +433,7 @@  static void test_synth_compare(struct test_synth *synth, struct tracefs_dynevent
 		free(event);
 		free(format);
 	}
-	CU_TEST(devents[i] == NULL);
+	CU_TEST(devents == NULL || devents[i] == NULL);
 }
 
 static void test_instance_synthetic(struct tracefs_instance *instance)