mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fix memory leak in token authentication system
Must free claims after creating them!
This commit is contained in:
parent
6bc15b50b5
commit
b24e5815bc
@ -110,6 +110,8 @@ bool CClient::Authenticate(const char* const playerName, char* const reasonBuf,
|
||||
if (r != L8W8JWT_SUCCESS)
|
||||
{
|
||||
FORMAT_ERROR_REASON("Code %i", r);
|
||||
l8w8jwt_free_claims(claims, numClaims);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -119,6 +121,8 @@ bool CClient::Authenticate(const char* const playerName, char* const reasonBuf,
|
||||
l8w8jwt_get_validation_result_desc(validation_result, reasonBuffer, sizeof(reasonBuffer));
|
||||
|
||||
FORMAT_ERROR_REASON("%s", reasonBuffer);
|
||||
l8w8jwt_free_claims(claims, numClaims);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -143,6 +147,8 @@ bool CClient::Authenticate(const char* const playerName, char* const reasonBuf,
|
||||
if (hashedNewId.compare(sessionId) != 0)
|
||||
{
|
||||
FORMAT_ERROR_REASON("Token is not authorized for the connecting client");
|
||||
l8w8jwt_free_claims(claims, numClaims);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -153,9 +159,13 @@ bool CClient::Authenticate(const char* const playerName, char* const reasonBuf,
|
||||
if (!foundSessionId)
|
||||
{
|
||||
FORMAT_ERROR_REASON("No session ID");
|
||||
l8w8jwt_free_claims(claims, numClaims);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
l8w8jwt_free_claims(claims, numClaims);
|
||||
|
||||
#undef REJECT_CONNECTION
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user