Ensure all locks are properly cleaned up
[openssl.git] / crypto / err / err.c
index 3ee4e861d4b227c919f35a966f43e808c32cacb1..aff3ae5a24e75656d6e96c5fb12c94011bc35232 100644 (file)
 #include <string.h>
 #include <internal/cryptlib_int.h>
 #include <internal/threads.h>
 #include <string.h>
 #include <internal/cryptlib_int.h>
 #include <internal/threads.h>
+#include <internal/err.h>
 #include <openssl/lhash.h>
 #include <openssl/crypto.h>
 #include <openssl/buffer.h>
 #include <openssl/lhash.h>
 #include <openssl/crypto.h>
 #include <openssl/buffer.h>
@@ -389,9 +390,13 @@ static void ERR_STATE_free(ERR_STATE *s)
 
 static void do_err_strings_init(void)
 {
 
 static void do_err_strings_init(void)
 {
-    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
     err_string_lock = CRYPTO_THREAD_lock_new();
     err_string_lock = CRYPTO_THREAD_lock_new();
-    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
+}
+
+void err_cleanup(void)
+{
+    CRYPTO_THREAD_lock_free(err_string_lock);
+    err_string_lock = NULL;
 }
 
 void ERR_load_ERR_strings(void)
 }
 
 void ERR_load_ERR_strings(void)