]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Clean up OpenSSL manually
authorMatthew Newton <matthew-git@newtoncomputing.co.uk>
Wed, 9 Jan 2019 19:57:59 +0000 (19:57 +0000)
committerMatthew Newton <matthew-git@newtoncomputing.co.uk>
Wed, 9 Jan 2019 19:57:59 +0000 (19:57 +0000)
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.

src/lib/tls/base.c

index 3389faa90174b3a90a40906a766e3c0ec5bc926d..f8a7401d71ac7ac4f508df4476a02ee7403d9bc6 100644 (file)
@@ -455,7 +455,10 @@ static void openssl_free(void *to_free)
 #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)
 {
@@ -475,6 +478,7 @@ void tls_free(void)
 #else
 void tls_free(void)
 {
+       OPENSSL_cleanup();
        fr_dict_autofree(tls_dict);
 }
 #endif