From 8c7db0ad6cbdcfa7d80636ed13ba657e7189420e Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Fri, 3 Sep 2021 22:21:29 +0300
Subject: [PATCH] SL-15902 Cleanup gSecAPIHandler

---
 indra/llcorehttp/httpcommon.cpp | 3 ---
 indra/newview/llappviewer.cpp   | 4 +++-
 indra/newview/llsecapi.cpp      | 6 ++++++
 indra/newview/llsecapi.h        | 2 ++
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/indra/llcorehttp/httpcommon.cpp b/indra/llcorehttp/httpcommon.cpp
index bbf23a6d70b..61ba83594e0 100644
--- a/indra/llcorehttp/httpcommon.cpp
+++ b/indra/llcorehttp/httpcommon.cpp
@@ -270,9 +270,6 @@ namespace LLHttp
 {
 namespace
 {
-typedef boost::shared_ptr<LLMutex> LLMutex_ptr;
-std::vector<LLMutex_ptr> sSSLMutex;
-
 CURL *getCurlTemplateHandle()
 {
     static CURL *curlpTemplateHandle = NULL;
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 72eb344ded5..69606793db8 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2006,7 +2006,9 @@ bool LLAppViewer::cleanup()
 	if (LLConversationLog::instanceExists())
 	{
 		LLConversationLog::instance().cache();
-	}
+    }
+
+    clearSecHandler();
 
 	if (mPurgeCacheOnExit)
 	{
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index b9259cb18df..aba8ca5a4af 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -75,6 +75,12 @@ void initializeSecHandler()
 	}
 
 }
+
+void clearSecHandler()
+{
+    gSecAPIHandler = NULL;
+    gHandlerMap.clear();
+}
 // start using a given security api handler.  If the string is empty
 // the default is used
 LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type)
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index 1e6f2154bca..410737b27f7 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -533,6 +533,8 @@ class LLSecAPIHandler : public LLThreadSafeRefCount
 };
 
 void initializeSecHandler();
+
+void clearSecHandler();
 				
 // retrieve a security api depending on the api type
 LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type);
-- 
GitLab