1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Mayaqua: revamp RecvHttpHeader() so that cleanup functions are not called twice

This commit is contained in:
Davide Beatrici 2018-12-19 20:00:18 +01:00
parent 30f37beed2
commit ada06e218e

View File

@ -20563,13 +20563,15 @@ HTTP_HEADER *RecvHttpHeader(SOCK *s)
// Split into tokens
token = ParseToken(str, " ");
if (token->NumTokens < 3)
{
goto LABEL_ERROR;
}
Free(str);
if (token->NumTokens < 3)
{
FreeToken(token);
return NULL;
}
// Creating a header object
header = NewHttpHeader(token->Token[0], token->Token[1], token->Token[2]);
FreeToken(token);
@ -20594,21 +20596,15 @@ HTTP_HEADER *RecvHttpHeader(SOCK *s)
if (AddHttpValueStr(header, str) == false)
{
goto LABEL_ERROR;
Free(str);
FreeHttpHeader(header);
break;
}
Free(str);
}
return header;
LABEL_ERROR:
// Memory release
Free(str);
FreeToken(token);
FreeHttpHeader(header);
return NULL;
}
// Receive a line