Not recommended by OpenSSL, but this is to stop segfaults in the
atexit handler because the memory has already been freed with the
main config.
#if OPENSSL_VERSION_NUMBER < 0x10100000L
/** Free any memory alloced by libssl
*
- * OpenSSL >= 1.1.0 uses an atexit handler to automatically free memory
+ * OpenSSL >= 1.1.0 uses an atexit handler to automatically free
+ * memory. However, we need to call it manually because some of
+ * the SSL ctx is parented to the main config which will get freed
+ * before the atexit handler, causing a segfault on exit.
*/
void tls_free(void)
{
#else
void tls_free(void)
{
+ OPENSSL_cleanup();
fr_dict_autofree(tls_dict);
}
#endif