openssl: Fix (harmless) memory leaks at exit.
[paraslash.git] / openssl.c
index 5f04c84..0ad9d7d 100644 (file)
--- a/openssl.c
+++ b/openssl.c
@@ -60,6 +60,12 @@ void crypt_shutdown(void)
 #ifdef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA
        CRYPTO_cleanup_all_ex_data();
 #endif
+#ifdef HAVE_OPENSSL_THREAD_STOP /* openssl-1.1 or later */
+       OPENSSL_thread_stop();
+#else /* openssl-1.0 */
+       ERR_remove_thread_state(NULL);
+#endif
+       EVP_cleanup();
 }
 
 /*