1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-04 16:45:06 -05:00

openssl: fix per-thread memory leak usiong 1.0.1 or 1.0.2

OpenSSL 1.0.1 and 1.0.2 build an error queue that is stored per-thread
so we need to clean it when easy handles are freed, in case the thread
will be killed in which the easy handle was used. All OpenSSL code in
libcurl should extract the error in association with the error already
so clearing this queue here should be harmless at worst.

Fixes #964
This commit is contained in:
Daniel Stenberg 2016-08-29 23:18:31 +02:00
parent 4ba1569ad1
commit d93215621f

View File

@ -1056,6 +1056,14 @@ void Curl_ossl_close_all(struct Curl_easy *data)
#else #else
(void)data; (void)data;
#endif #endif
#if !defined(HAVE_ERR_REMOVE_THREAD_STATE_DEPRECATED) && \
defined(HAVE_ERR_REMOVE_THREAD_STATE)
/* OpenSSL 1.0.1 and 1.0.2 build an error queue that is stored per-thread
so we need to clean it here in case the thread will be killed. All OpenSSL
code should extract the error in association with the error so clearing
this queue here should be harmless at worst. */
ERR_remove_thread_state(NULL);
#endif
} }
/* ====================================================== */ /* ====================================================== */