mirror of https://github.com/openssl/openssl.git
GH773: Possible leak on CRYPTO_THREAD_lock_new failure
Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
parent
e257b2c2ae
commit
0b2fc9286f
|
|
@ -58,8 +58,10 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
|
|||
if (lock == NULL)
|
||||
return NULL;
|
||||
|
||||
if (pthread_rwlock_init(lock, NULL) != 0)
|
||||
if (pthread_rwlock_init(lock, NULL) != 0) {
|
||||
OPENSSL_free(lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return lock;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,10 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
|
|||
return NULL;
|
||||
|
||||
/* 0x400 is the spin count value suggested in the documentation */
|
||||
if (!InitializeCriticalSectionAndSpinCount(lock, 0x400))
|
||||
if (!InitializeCriticalSectionAndSpinCount(lock, 0x400)) {
|
||||
OPENSSL_free(lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return lock;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue