Add a NULL check with OPENSSL_assert() before dereferencing the allocated pointer.
Fixes #30017
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 24 17:44:44 2026
(Merged from https://github.com/openssl/openssl/pull/30509)
t1 = ossl_time_now();
for (count = 0;; count++) {
- new = CRYPTO_zalloc(sizeof(int), NULL, 0);
+ new = OPENSSL_zalloc(sizeof(int));
+ OPENSSL_assert(new != NULL);
if (contention == 0)
OSSL_sleep(1000);
if (!CRYPTO_THREAD_write_lock(rwtorturelock))
t1 = ossl_time_now();
for (count = 0;; count++) {
- new = CRYPTO_malloc(sizeof(uint64_t), NULL, 0);
+ new = OPENSSL_zalloc(sizeof(uint64_t));
+ OPENSSL_assert(new != NULL);
*new = (uint64_t)0xBAD;
if (contention == 0)
OSSL_sleep(1000);