Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index 4d353d7..27b94e3 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -369,10 +369,12 @@ HttpParseUrl (
UINT32 Field;
UINT32 OldField;
BOOLEAN FoundAt;
EFI_STATUS Status;
HTTP_URL_PARSER *Parser;
+
+ Parser = NULL;
if (Url == NULL || Length == 0 || UrlParser == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -399,10 +401,11 @@ HttpParseUrl (
//
State = NetHttpParseUrlChar (*Char, State);
switch (State) {
case UrlParserStateMax:
+ FreePool (Parser);
return EFI_INVALID_PARAMETER;
case UrlParserSchemeColon:
case UrlParserSchemeColonSlash:
case UrlParserSchemeColonSlashSlash:
@@ -461,10 +464,11 @@ HttpParseUrl (
// If has authority component, continue to parse the username, host and port.
//
if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_AUTHORITY)) != 0) {
Status = NetHttpParseAuthority (Url, FoundAt, Parser);
if (EFI_ERROR (Status)) {
+ FreePool (Parser);
return Status;
}
}
*UrlParser = Parser;
@@ -1525,10 +1529,11 @@ HttpSetFieldNameAndValue (
HttpHeader->FieldName[FieldNameSize - 1] = 0;
FieldValueSize = AsciiStrSize (FieldValue);
HttpHeader->FieldValue = AllocateZeroPool (FieldValueSize);
if (HttpHeader->FieldValue == NULL) {
+ FreePool (HttpHeader->FieldName);
return EFI_OUT_OF_RESOURCES;
}
CopyMem (HttpHeader->FieldValue, FieldValue, FieldValueSize);
HttpHeader->FieldValue[FieldValueSize - 1] = 0;
--
1.9.5.msysgit.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel