From 21f51f0f48a63a907716b9e49d9bfe7cf192ea80 Mon Sep 17 00:00:00 2001 From: "Wilson E. Alvarez" Date: Sun, 9 Apr 2017 22:28:05 -0400 Subject: [PATCH] Fixed WebSocket.cpp memory leaks (#17653) --- cocos/network/WebSocket.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cocos/network/WebSocket.cpp b/cocos/network/WebSocket.cpp index e09496a025..89c83ecb6e 100644 --- a/cocos/network/WebSocket.cpp +++ b/cocos/network/WebSocket.cpp @@ -362,6 +362,7 @@ void WsThreadHelper::onSubThreadLoop() if (msg->what == WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION) { ws->onClientOpenConnectionRequest(); + delete *iter; iter = __wsHelper->_subThreadWsMessageQueue->erase(iter); } else @@ -509,6 +510,7 @@ void WebSocket::closeAllConnections() std::lock_guard lk(__instanceMutex); __websocketInstances->clear(); + delete __websocketInstances; __websocketInstances = nullptr; } }