Fixed WebSocket.cpp memory leaks (#17672)

This commit is contained in:
James Chen 2017-04-10 14:16:55 +08:00 committed by minggo
parent 97adaabefb
commit 4dac6b3f36
1 changed files with 2 additions and 0 deletions

View File

@ -362,6 +362,7 @@ void WsThreadHelper::onSubThreadLoop()
if (msg->what == WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION) if (msg->what == WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION)
{ {
ws->onClientOpenConnectionRequest(); ws->onClientOpenConnectionRequest();
delete *iter;
iter = __wsHelper->_subThreadWsMessageQueue->erase(iter); iter = __wsHelper->_subThreadWsMessageQueue->erase(iter);
} }
else else
@ -509,6 +510,7 @@ void WebSocket::closeAllConnections()
std::lock_guard<std::mutex> lk(__instanceMutex); std::lock_guard<std::mutex> lk(__instanceMutex);
__websocketInstances->clear(); __websocketInstances->clear();
delete __websocketInstances;
__websocketInstances = nullptr; __websocketInstances = nullptr;
} }
} }