From b91acb61c474ed71a1fa3a2e7a2ea8f9927245fe Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Fri, 16 Sep 2022 16:45:19 -0700
Subject: [PATCH] Fix crash when cleanup() was called twice in a row, e.g.
 load_cfg failure

Need to nullify the xpms after destroying/freeing (as is done in other
servers already).
---
 src/sbbs3/main.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index 5ab6f07fc7..af8bb736b1 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -4744,6 +4744,7 @@ static void cleanup(int code)
     lputs(LOG_INFO,"Terminal Server thread terminating");
 
 	xpms_destroy(ts_set, sock_close_cb, startup);
+	ts_set = NULL;
 
 #ifdef _WINSOCKAPI_
 	if(WSAInitialized && WSACleanup()!=0)
-- 
GitLab