From 062f3214fc3e7f4dbecd9518abbfa3db4445a951 Mon Sep 17 00:00:00 2001 From: macaronnik Date: Sun, 5 Apr 2015 19:04:44 +0300 Subject: [PATCH] Cleanup ssl library. No memory leaks. --- src/Mayaqua/Encrypt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index 8a67462a..6009d00d 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -4138,6 +4138,22 @@ void FreeOpenSSLThreadState() ERR_remove_state(0); } +void FreeSsl() +{ + /* thread-safe cleanup */ + ERR_remove_state(0); + ENGINE_cleanup(); + CONF_modules_unload(1); + + sk_free(SSL_COMP_get_compression_methods()); + + /* global application exit cleanup (after all SSL activity is shutdown) */ + ERR_free_strings(); + EVP_cleanup(); + CRYPTO_cleanup_all_ex_data(); + +} + // Release the Crypt library void FreeCryptLibrary() { @@ -4147,6 +4163,8 @@ void FreeCryptLibrary() openssl_lock = NULL; // RAND_Free_For_SoftEther(); OpenSSL_FreeLock(); + + FreeSsl(); } // Initialize the Crypt library