Use appropriate OpenSSL thread cleanup function or don't use any,
depending on their deprecation status in various OpenSSL versions.
* must remove the thread's error queue before
* exiting to prevent memory leaks.
*/
+#if OPENSSL_VERSION_NUMBER < 0x10000000L
ERR_remove_state(0);
+#elif OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ ERR_remove_thread_state(NULL);
+#endif
#endif
pthread_mutex_lock(&thread_pool.queue_mutex);
*/
void tls_global_cleanup(void)
{
+#if OPENSSL_VERSION_NUMBER < 0x10000000L
ERR_remove_state(0);
+#elif OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ ERR_remove_thread_state(NULL);
+#endif
ENGINE_cleanup();
CONF_modules_unload(1);
ERR_free_strings();