Browse Source

GH773: Possible leak on CRYPTO_THREAD_lock_new failure

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
master
FdaSilvaYY 7 years ago
committed by Rich Salz
parent
commit
0b2fc9286f
2 changed files with 6 additions and 2 deletions
  1. +3
    -1
      crypto/threads_pthread.c
  2. +3
    -1
      crypto/threads_win.c

+ 3
- 1
crypto/threads_pthread.c View File

@ -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;
}


+ 3
- 1
crypto/threads_win.c View File

@ -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…
Cancel
Save