fix submitted by Andy Schneider <andy.schneider@bjss.co.uk>
[openssl.git] / crypto / cryptlib.c
index e9c9b3b5a226e9572151c1f5973ac7d8d22f3e62..2f62fd77c64973e2fdde2feeb583117b8f35d6a7 100644 (file)
@@ -74,7 +74,7 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] =
        {
        "<<ERROR>>",
        "err",
-       "err_hash",
+       "ex_data",
        "x509",
        "x509_info",
        "x509_pkey",
@@ -90,6 +90,7 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] =
        "ssl_sess_cert",
        "ssl",
        "rand",
+       "rand2",
        "debug_malloc",
        "BIO",
        "gethostbyname",
@@ -102,7 +103,7 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] =
        "dynlock",
        "engine",
        "ui",
-#if CRYPTO_NUM_LOCKS != 30
+#if CRYPTO_NUM_LOCKS != 31
 # error "Inconsistency between crypto.h and cryptlib.c"
 #endif
        };
@@ -229,7 +230,10 @@ void CRYPTO_destroy_dynlockid(int i)
        CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
 
        if (dyn_locks == NULL || i >= sk_CRYPTO_dynlock_num(dyn_locks))
+               {
+               CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
                return;
+               }
        pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
        if (pointer != NULL)
                {
@@ -431,7 +435,6 @@ int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
                        CRYPTO_get_lock_name(type),
                        file,line);
 #endif
-               *pointer=ret;
                }
        else
                {