diff --git a/crypto/err/err_impl.c b/crypto/err/err_impl.c index 7428fb73..e448d65b 100644 --- a/crypto/err/err_impl.c +++ b/crypto/err/err_impl.c @@ -293,6 +293,10 @@ static void err_shutdown(void) { lh_ERR_STRING_DATA_free(error_hash); error_hash = NULL; } + if (state_hash) { + lh_ERR_STATE_free(state_hash); + state_hash = NULL; + } CRYPTO_w_unlock(CRYPTO_LOCK_ERR); } diff --git a/crypto/ex_data_impl.c b/crypto/ex_data_impl.c index cac1daac..f55b3697 100644 --- a/crypto/ex_data_impl.c +++ b/crypto/ex_data_impl.c @@ -167,6 +167,7 @@ static void data_funcs_free(CRYPTO_EX_DATA_FUNCS *funcs) { * structures. */ static void class_free(EX_CLASS_ITEM *item) { sk_CRYPTO_EX_DATA_FUNCS_pop_free(item->meth, data_funcs_free); + OPENSSL_free(item); } static LHASH_OF(EX_CLASS_ITEM) *get_classes(void) { diff --git a/include/openssl/err.h b/include/openssl/err.h index 071c5ba3..8e997676 100644 --- a/include/openssl/err.h +++ b/include/openssl/err.h @@ -148,8 +148,10 @@ extern "C" { * human-readable strings. */ OPENSSL_EXPORT void ERR_load_crypto_strings(void); -/* ERR_free_strings frees any internal error values that have been loaded. This - * should only be called at process shutdown. */ +/* ERR_free_strings frees any memory retained by the error system, expect for + * per-thread structures which are assumed to have already been freed with + * |ERR_remove_thread_state|. This should only be called at process + * shutdown. */ OPENSSL_EXPORT void ERR_free_strings(void);