diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-10-03 15:23:05 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-10-05 10:20:10 +1100 |
commit | 894f2166ef2c16d8e4533e1c09e05ff31ea2f1d8 (patch) | |
tree | 1c74625f8bf9e9dd3642793cabe26cddead10050 /crypto/threads_win.c | |
parent | ed49476a16b8ff2688a53a2ba7e011e6911620f8 (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.c | 6 |
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 */ |