summaryrefslogtreecommitdiffstats
path: root/crypto/threads_win.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-10-03 15:23:05 +0200
committerPauli <pauli@openssl.org>2022-10-05 10:20:10 +1100
commit894f2166ef2c16d8e4533e1c09e05ff31ea2f1d8 (patch)
tree1c74625f8bf9e9dd3642793cabe26cddead10050 /crypto/threads_win.c
parented49476a16b8ff2688a53a2ba7e011e6911620f8 (diff)
CRYPTO_THREAD_lock_new(): Avoid infinite recursion on allocation error
Fixes #19334 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19335)
Diffstat (limited to 'crypto/threads_win.c')
-rw-r--r--crypto/threads_win.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/threads_win.c b/crypto/threads_win.c
index b5e4d18a84..3992ba4440 100644
--- a/crypto/threads_win.c
+++ b/crypto/threads_win.c
@@ -43,16 +43,16 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
# ifdef USE_RWLOCK
CRYPTO_win_rwlock *rwlock;
- if ((lock = OPENSSL_zalloc(sizeof(CRYPTO_win_rwlock))) == NULL)
+ if ((lock = CRYPTO_zalloc(sizeof(CRYPTO_win_rwlock), NULL, 0)) == NULL)
+ /* Don't set error, to avoid recursion blowup. */
return NULL;
rwlock = lock;
InitializeSRWLock(&rwlock->lock);
# else
- if ((lock = OPENSSL_zalloc(sizeof(CRITICAL_SECTION))) == NULL) {
+ if ((lock = CRYPTO_zalloc(sizeof(CRITICAL_SECTION), NULL, 0)) == NULL)
/* Don't set error, to avoid recursion blowup. */
return NULL;
- }
# if !defined(_WIN32_WCE)
/* 0x400 is the spin count value suggested in the documentation */