MdeModulePkg: Fix potential memory leaks in DxeHttpLib.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Paulo Alcantara <pcacjr@gmail.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
This commit is contained in:
committed by
Fu Siyuan
parent
aff463c825
commit
df642d70e3
@ -523,6 +523,7 @@ HttpUrlGetHostName (
|
|||||||
&ResultLength
|
&ResultLength
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
FreePool (Name);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,6 +583,7 @@ HttpUrlGetIp4 (
|
|||||||
&ResultLength
|
&ResultLength
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
FreePool (Ip4String);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,6 +659,7 @@ HttpUrlGetIp6 (
|
|||||||
&ResultLength
|
&ResultLength
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
FreePool (Ip6String);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,14 +725,15 @@ HttpUrlGetPort (
|
|||||||
&ResultLength
|
&ResultLength
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
PortString[ResultLength] = '\0';
|
PortString[ResultLength] = '\0';
|
||||||
|
|
||||||
while (Index < ResultLength) {
|
while (Index < ResultLength) {
|
||||||
if (!NET_IS_DIGIT (PortString[Index])) {
|
if (!NET_IS_DIGIT (PortString[Index])) {
|
||||||
return EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
Index ++;
|
Index ++;
|
||||||
}
|
}
|
||||||
@ -737,10 +741,14 @@ HttpUrlGetPort (
|
|||||||
Status = AsciiStrDecimalToUintnS (Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, &Data);
|
Status = AsciiStrDecimalToUintnS (Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, &Data);
|
||||||
|
|
||||||
if (Data > HTTP_URI_PORT_MAX_NUM) {
|
if (Data > HTTP_URI_PORT_MAX_NUM) {
|
||||||
return EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Port = (UINT16) Data;
|
*Port = (UINT16) Data;
|
||||||
|
|
||||||
|
ON_EXIT:
|
||||||
|
FreePool (PortString);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -795,6 +803,7 @@ HttpUrlGetPath (
|
|||||||
&ResultLength
|
&ResultLength
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
FreePool (PathStr);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user