mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-12-26 18:19:53 +03:00
Mayaqua: add new FreeSafe() function which calls Free() and set the pointer's value to NULL
This commit is contained in:
parent
ada06e218e
commit
bd01cbff9a
@ -3777,6 +3777,13 @@ void Free(void *addr)
|
||||
InternalFree(tag);
|
||||
}
|
||||
|
||||
// Free and set pointer's value to NULL
|
||||
void FreeSafe(void **addr)
|
||||
{
|
||||
Free(*addr);
|
||||
*addr = NULL;
|
||||
}
|
||||
|
||||
// Check the memtag
|
||||
void CheckMemTag(MEMTAG *tag)
|
||||
{
|
||||
|
@ -276,6 +276,7 @@ void *ZeroMalloc(UINT size);
|
||||
void *ZeroMallocEx(UINT size, bool zero_clear_when_free);
|
||||
void *ReAlloc(void *addr, UINT size);
|
||||
void Free(void *addr);
|
||||
void FreeSafe(void **addr);
|
||||
void CheckMemTag(MEMTAG *tag);
|
||||
UINT GetMemSize(void *addr);
|
||||
|
||||
|
@ -20564,7 +20564,7 @@ HTTP_HEADER *RecvHttpHeader(SOCK *s)
|
||||
// Split into tokens
|
||||
token = ParseToken(str, " ");
|
||||
|
||||
Free(str);
|
||||
FreeSafe((void **)&str);
|
||||
|
||||
if (token->NumTokens < 3)
|
||||
{
|
||||
@ -20590,18 +20590,18 @@ HTTP_HEADER *RecvHttpHeader(SOCK *s)
|
||||
if (IsEmptyStr(str))
|
||||
{
|
||||
// End of header
|
||||
Free(str);
|
||||
FreeSafe((void **)&str);
|
||||
break;
|
||||
}
|
||||
|
||||
if (AddHttpValueStr(header, str) == false)
|
||||
{
|
||||
Free(str);
|
||||
FreeSafe((void **)&str);
|
||||
FreeHttpHeader(header);
|
||||
break;
|
||||
}
|
||||
|
||||
Free(str);
|
||||
FreeSafe((void **)&str);
|
||||
}
|
||||
|
||||
return header;
|
||||
|
Loading…
Reference in New Issue
Block a user