summaryrefslogtreecommitdiffstats
path: root/crypto/init.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-03-11 09:52:52 +0000
committerMatt Caswell <matt@openssl.org>2016-03-11 13:36:57 +0000
commit773fd0bad487fe8f1cf722ca14cec2c4a2da3e21 (patch)
tree31d942284eb1b80b90b0f4b9cd4ae64f67e5c5d3 /crypto/init.c
parent71627423e57882a038e65993c948b2ec78c837a1 (diff)
Call CONF_modules_free() before ENGINE_cleanup() in auto-deinit
During auto de-init we were calling ENGINE_cleanup(), and then later CONF_modules_free(). However the latter function can end up calling engine code, which can lead to a use of the global_engine_lock after it has already been freed. Therefore we should swap the calling order of these two functions. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/init.c')
-rw-r--r--crypto/init.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/init.c b/crypto/init.c
index 1cac74193f..aac87deb4e 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -469,12 +469,12 @@ void OPENSSL_cleanup(void)
"RAND_cleanup()\n");
#endif
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_cleanup();
-#endif
CRYPTO_cleanup_all_ex_data();
EVP_cleanup();
CONF_modules_free();
+#ifndef OPENSSL_NO_ENGINE
+ ENGINE_cleanup();
+#endif
RAND_cleanup();
base_inited = 0;
}