Skip to content

Commit 24bde9d

Browse files
committed
fixed:sometime memory leak for verification module with xauth
1 parent 15ce3ed commit 24bde9d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

XEngine_Module/XEngine_Verification/Verification_XAuth/Verification_XAuthNet.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ bool CVerification_XAuthNet::Verification_XAuthNet_Login(LPCXSTR lpszUser, LPCXS
434434
}
435435

436436
nMsgLen = 0;
437-
XCHAR* ptszMsgBuffer;
437+
XCHAR* ptszMsgBuffer = NULL;
438438
st_ProtocolHdr = {};
439439
//接受数据
440440
if (!XClient_TCPSelect_RecvPkt(m_hSocket, &ptszMsgBuffer, &nMsgLen, &st_ProtocolHdr))
@@ -443,6 +443,7 @@ bool CVerification_XAuthNet::Verification_XAuthNet_Login(LPCXSTR lpszUser, LPCXS
443443
Verification_dwErrorCode = XClient_GetLastError();
444444
return false;
445445
}
446+
BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
446447
//判断是否登录协议
447448
if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPLOGIN != st_ProtocolHdr.unOperatorCode)
448449
{
@@ -563,7 +564,7 @@ bool CVerification_XAuthNet::Verification_XAuthNet_Logout(LPCXSTR lpszUser, LPCX
563564
}
564565

565566
nMsgLen = 0;
566-
XCHAR* ptszMsgBuffer;
567+
XCHAR* ptszMsgBuffer = NULL;
567568
st_ProtocolHdr = {};
568569
//接受数据
569570
if (!XClient_TCPSelect_RecvPkt(m_hSocket, &ptszMsgBuffer, &nMsgLen, &st_ProtocolHdr))
@@ -572,6 +573,7 @@ bool CVerification_XAuthNet::Verification_XAuthNet_Logout(LPCXSTR lpszUser, LPCX
572573
Verification_dwErrorCode = XClient_GetLastError();
573574
return false;
574575
}
576+
BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
575577
//判断是否登录协议
576578
if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQLOGOUT != st_ProtocolHdr.unOperatorCode)
577579
{

0 commit comments

Comments
 (0)