[openssl-commits] [openssl] master update

Dr. Stephen Henson steve at openssl.org
Wed Jul 20 11:46:07 UTC 2016


The branch master has been updated
       via  23dd0c9f8dc6f7edf4b872d13e5644dfbbee585b (commit)
      from  2f8e53d7944b3d659c8ae678163eb0f096a6d992 (commit)


- Log -----------------------------------------------------------------
commit 23dd0c9f8dc6f7edf4b872d13e5644dfbbee585b
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Wed Jul 20 02:57:23 2016 +0100

    fix crypto-mdebug build
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

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

Summary of changes:
 crypto/mem_dbg.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c
index 0307c02..dc3f8ff 100644
--- a/crypto/mem_dbg.c
+++ b/crypto/mem_dbg.c
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include "internal/cryptlib.h"
+#include "internal/thread_once.h"
 #include <openssl/crypto.h>
 #include <openssl/buffer.h>
 #include "internal/bio.h"
@@ -87,11 +88,19 @@ static unsigned int num_disable = 0;
  */
 static CRYPTO_THREAD_ID disabling_threadid;
 
-static void do_memdbg_init(void)
+DEFINE_RUN_ONCE_STATIC(do_memdbg_init)
 {
     malloc_lock = CRYPTO_THREAD_lock_new();
     long_malloc_lock = CRYPTO_THREAD_lock_new();
-    CRYPTO_THREAD_init_local(&appinfokey, NULL);
+    if (malloc_lock == NULL || long_malloc_lock == NULL
+        || !CRYPTO_THREAD_init_local(&appinfokey, NULL)) {
+        CRYPTO_THREAD_lock_free(malloc_lock);
+        malloc_lock = NULL;
+        CRYPTO_THREAD_lock_free(long_malloc_lock);
+        long_malloc_lock = NULL;
+        return 0;
+    }
+    return 1;
 }
 
 static void app_info_free(APP_INFO *inf)


More information about the openssl-commits mailing list