From afcf7fa757f95fe00d8709a1b6d932f8cd54a391 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Thu, 8 Mar 2018 19:09:20 +0000
Subject: [PATCH] We don't need any of this cleanup on TLS negotiation
 failure... in fact, free() the mailproc causes a double-free crash.

---
 src/sbbs3/mailsrvr.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c
index 31d6dccc9d..87d32ca42d 100644
--- a/src/sbbs3/mailsrvr.c
+++ b/src/sbbs3/mailsrvr.c
@@ -4689,23 +4689,11 @@ static void smtp_thread(void* arg)
 			sockprintf(socket, -1, "220 Ready to start TLS");
 			if (cryptSetAttribute(session, CRYPT_SESSINFO_ACTIVE, 1) != CRYPT_OK) {
 				lprintf(LOG_ERR, "%04d !SMTP Unable to set session active", socket);
-				cryptDestroySession(session);
-				mail_close_socket(socket);
-				thread_down();
-				protected_uint32_adjust(&active_clients, -1);
-				update_clients();
-				free(mailproc_to_match);
 				break;
 			}
 			if (startup->max_inactivity) {
 				if (cryptSetAttribute(session, CRYPT_OPTION_NET_READTIMEOUT, startup->max_inactivity) != CRYPT_OK) {
 					lprintf(LOG_ERR, "%04d !SMTP Unable to set max inactivity", socket);
-					cryptDestroySession(session);
-					mail_close_socket(socket);
-					thread_down();
-					protected_uint32_adjust(&active_clients, -1);
-					update_clients();
-					free(mailproc_to_match);
 					break;
 				}
 			}
-- 
GitLab