ssluse.c: fix calling of OpenSSL's ERR_remove_state(0)
authorYang Tse <yangsita@gmail.com>
Fri, 4 Nov 2011 12:08:37 +0000 (13:08 +0100)
committerYang Tse <yangsita@gmail.com>
Fri, 4 Nov 2011 12:08:37 +0000 (13:08 +0100)
commit73029dca5aacef7083a41e61c9e0842c012c452c
tree2e22e15b66be04d348d7cf91a7f6c6ee4e105228
parent5b57c544161987e7deb651110fff4f34a8b0c1ca
ssluse.c: fix calling of OpenSSL's ERR_remove_state(0)

Move calling of ERR_remove_state(0) a.k.a ERR_remove_thread_state(NULL)
from Curl_ossl_close_all() to Curl_ossl_cleanup().

In this way ERR_remove_state(0) is now only called in libcurl by
curl_global_cleanup(). Previously it would get called by functions
curl_easy_cleanup(), curl_multi_cleanup and potentially each time a
connection was removed from a connection cache leading to premature
destruction of OpenSSL's thread local state hash.

Multi-threaded apps using OpenSSL enabled libcurl should still call
function ERR_remove_state(0) or ERR_remove_thread_state(NULL) at the
very end end of threads that do not call curl_global_cleanup().
lib/ssluse.c