... and only release the TLS backend resources if there
are no active connections left.
Prevents crashes when exiting "gracefully" at the wrong time.
/* NOTREACHED unless FEATURE_GRACEFUL_TERMINATION is defined */
/* NOTREACHED unless FEATURE_GRACEFUL_TERMINATION is defined */
-#ifdef FEATURE_HTTPS_INSPECTION
- /* Clean up. Aim: free all memory (no leaks) */
- ssl_release();
-#endif
-
#ifdef FEATURE_GRACEFUL_TERMINATION
log_error(LOG_LEVEL_INFO, "Graceful termination requested.");
#ifdef FEATURE_GRACEFUL_TERMINATION
log_error(LOG_LEVEL_INFO, "Graceful termination requested.");
+#ifdef FEATURE_HTTPS_INSPECTION
+ /*
+ * Only release TLS backed resources if there
+ * are no active connections left.
+ */
+ if (clients->next == NULL)
+ {
+ ssl_release();
+ }
+#endif
+
log_error(LOG_LEVEL_INFO, "Exiting gracefully.");
#if defined(_WIN32) && !defined(_WIN_CONSOLE)
log_error(LOG_LEVEL_INFO, "Exiting gracefully.");
#if defined(_WIN32) && !defined(_WIN_CONSOLE)