[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Fri Mar 4 00:47:17 UTC 2016


The branch master has been updated
       via  0b2fc9286f84d12f2f103b0d29c9e6e1e2a6bf87 (commit)
      from  e257b2c2aeeb010693ae79458751a030a7961b84 (commit)


- Log -----------------------------------------------------------------
commit 0b2fc9286f84d12f2f103b0d29c9e6e1e2a6bf87
Author: FdaSilvaYY <fdasilvayy at gmail.com>
Date:   Tue Mar 1 21:59:48 2016 +0100

    GH773: Possible leak on CRYPTO_THREAD_lock_new failure
    
    Signed-off-by: Rich Salz <rsalz at akamai.com>
    Reviewed-by: Matt Caswell <matt at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/threads_pthread.c | 4 +++-
 crypto/threads_win.c     | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c
index 2b32e14..edca77c 100644
--- a/crypto/threads_pthread.c
+++ b/crypto/threads_pthread.c
@@ -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;
 }
diff --git a/crypto/threads_win.c b/crypto/threads_win.c
index bee628f..741e8f8 100644
--- a/crypto/threads_win.c
+++ b/crypto/threads_win.c
@@ -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;
 }


More information about the openssl-commits mailing list