aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 364e10881..726e259ca 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -833,6 +833,17 @@ CURLcode Curl_disconnect(struct connectdata *conn)
#ifdef USE_SSLEAY
if (conn->ssl.use) {
+ /*
+ ERR_remove_state() frees the error queue associated with
+ thread pid. If pid == 0, the current thread will have its
+ error queue removed.
+
+ Since error queue data structures are allocated
+ automatically for new threads, they must be freed when
+ threads are terminated in oder to avoid memory leaks.
+ */
+ ERR_remove_state(0);
+
if(conn->ssl.handle) {
(void)SSL_shutdown(conn->ssl.handle);
SSL_set_connect_state(conn->ssl.handle);