GH773: Possible leak on CRYPTO_THREAD_lock_new failure
[openssl.git] / test / testutil.c
index 05ed589f7457191b5223e4697a31256285c31fa1..de5598cb28d7ed690a451dbd8818f4a822b6ecca 100644 (file)
@@ -1,4 +1,3 @@
-/* test/testutil.c */
 /*-
  * Utilities for writing OpenSSL unit tests.
  *
@@ -61,6 +60,7 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include "e_os.h"
 
 /*
  * Declares the structures needed to register each test case function.
@@ -75,7 +75,7 @@ static int num_tests = 0;
 
 void add_test(const char *test_case_name, int (*test_fn) ())
 {
-    assert(num_tests != (sizeof(all_tests) / sizeof(all_tests)[0]));
+    assert(num_tests != OSSL_NELEM(all_tests));
     all_tests[num_tests].test_case_name = test_case_name;
     all_tests[num_tests].test_fn = test_fn;
     ++num_tests;