From 80a530a6545cfa20df5a7d0514e9ed3ccba2636b Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Tue, 6 Apr 2021 15:06:50 +0100 Subject: [PATCH] Ensure the TLS dictionary is freed on exit --- src/bin/radiusd.c | 7 +++++++ src/lib/tls/base-h | 2 ++ src/lib/tls/base.c | 8 ++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/bin/radiusd.c b/src/bin/radiusd.c index b1782002fb..d7bc0f161b 100644 --- a/src/bin/radiusd.c +++ b/src/bin/radiusd.c @@ -1006,6 +1006,13 @@ cleanup: */ if (dl_modules) talloc_free(dl_modules); +#ifdef HAVE_OPENSSL_CRYPTO_H + /* + * Make sure we clean up the TLS dictionary... + */ + fr_tls_dict_free(); +#endif + /* * Cleanup everything else */ diff --git a/src/lib/tls/base-h b/src/lib/tls/base-h index 5aabd45b74..a94de33f86 100644 --- a/src/lib/tls/base-h +++ b/src/lib/tls/base-h @@ -429,6 +429,8 @@ void fr_openssl_free(void); int fr_tls_dict_init(void); +void fr_tls_dict_free(void); + /* * tls/log.c */ diff --git a/src/lib/tls/base.c b/src/lib/tls/base.c index da773a0833..6ef5d2be80 100644 --- a/src/lib/tls/base.c +++ b/src/lib/tls/base.c @@ -481,7 +481,7 @@ void fr_openssl_free(void) TALLOC_FREE(global_mutexes); - fr_dict_autofree(tls_dict); + fr_tls_dict_free(); } #else /** Free any memory alloced by libssl @@ -499,7 +499,7 @@ void fr_openssl_free(void) OPENSSL_cleanup(); - fr_dict_autofree(tls_dict); + fr_tls_dict_free(); } #endif @@ -583,4 +583,8 @@ int fr_tls_dict_init(void) return 0; } +void fr_tls_dict_free(void) +{ + fr_dict_autofree(tls_dict); +} #endif /* WITH_TLS */ -- 2.47.2