From: Nikolai Kondrashov Date: Wed, 23 Nov 2016 07:40:24 +0000 (+0200) Subject: Handle deprecated OpenSSL thread cleanup functions X-Git-Tag: release_3_0_13~92^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ce96912e751af095d40c06449bcf671387a2b76;p=thirdparty%2Ffreeradius-server.git Handle deprecated OpenSSL thread cleanup functions Use appropriate OpenSSL thread cleanup function or don't use any, depending on their deprecation status in various OpenSSL versions. --- diff --git a/src/main/threads.c b/src/main/threads.c index 58bc90803bd..cc79d0c555a 100644 --- a/src/main/threads.c +++ b/src/main/threads.c @@ -718,7 +718,11 @@ static void *request_handler_thread(void *arg) * 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); diff --git a/src/main/tls.c b/src/main/tls.c index 692bab70217..6cd912f0f7f 100644 --- a/src/main/tls.c +++ b/src/main/tls.c @@ -2526,7 +2526,11 @@ int tls_global_version_check(char const *acknowledged) */ 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();