summaryrefslogtreecommitdiffstats
path: root/crypto/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/init.c')
-rw-r--r--crypto/init.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/crypto/init.c b/crypto/init.c
index 1fa5e89420..d50d7f19e8 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -474,12 +474,17 @@ void OPENSSL_cleanup(void)
"RAND_cleanup()\n");
#endif
- CRYPTO_cleanup_all_ex_data();
- EVP_cleanup();
- CONF_modules_free();
+/*
+ * Note that cleanup order is important.
+ * For example, ENGINEs use CRYPTO_EX_DATA and therefore, must be cleaned up
+ * before the ex data handlers are wiped in CRYPTO_cleanup_all_ex_data().
+ */
#ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup();
#endif
+ CRYPTO_cleanup_all_ex_data();
+ EVP_cleanup();
+ CONF_modules_free();
RAND_cleanup();
base_inited = 0;
}
@@ -628,5 +633,3 @@ int OPENSSL_atexit(void (*handler)(void))
return 1;
}
-
-