mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Core/NetworkIO: Fixed memory leak
This commit is contained in:
@@ -277,18 +277,15 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
{
|
||||
if (!AntiDOS.EvaluateOpcode(*packet))
|
||||
{
|
||||
delete packet;
|
||||
packet = NULL;
|
||||
KickPlayer();
|
||||
}
|
||||
|
||||
if (packet && packet->GetOpcode() >= NUM_MSG_TYPES)
|
||||
else if (packet->GetOpcode() >= NUM_MSG_TYPES)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_OPCODES, "Received non-existed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
|
||||
, GetPlayerInfo().c_str());
|
||||
sScriptMgr->OnUnknownPacketReceive(m_Socket, WorldPacket(*packet));
|
||||
}
|
||||
else if (packet)
|
||||
else
|
||||
{
|
||||
OpcodeHandler &opHandle = opcodeTable[packet->GetOpcode()];
|
||||
try
|
||||
@@ -373,7 +370,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(ByteBufferException &)
|
||||
catch (ByteBufferException const&)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_GENERAL, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
|
||||
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
|
||||
@@ -383,6 +380,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
|
||||
if (deletePacket)
|
||||
delete packet;
|
||||
|
||||
deletePacket = true;
|
||||
}
|
||||
|
||||
if (m_Socket && !m_Socket->IsClosed() && _warden)
|
||||
|
||||
Reference in New Issue
Block a user