summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorPaulo Alcantara <pcacjr@gmail.com>2017-05-22 19:52:11 +0800
committerFu Siyuan <siyuan.fu@intel.com>2017-05-27 09:50:10 +0800
commitdf642d70e3966c5265e8992d63e39309ab25db7b (patch)
treee92a200cb769ccb0ca4eca03f6cbe036e2420e9a /MdeModulePkg
parentaff463c825a3bd46f2e82cc81b6ec959e705f8e9 (diff)
downloadedk2-df642d70e3966c5265e8992d63e39309ab25db7b.tar.gz
edk2-df642d70e3966c5265e8992d63e39309ab25db7b.tar.bz2
edk2-df642d70e3966c5265e8992d63e39309ab25db7b.zip
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index 8421caaa70..292923875f 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -523,6 +523,7 @@ HttpUrlGetHostName (
&ResultLength
);
if (EFI_ERROR (Status)) {
+ FreePool (Name);
return Status;
}
@@ -582,6 +583,7 @@ HttpUrlGetIp4 (
&ResultLength
);
if (EFI_ERROR (Status)) {
+ FreePool (Ip4String);
return Status;
}
@@ -657,6 +659,7 @@ HttpUrlGetIp6 (
&ResultLength
);
if (EFI_ERROR (Status)) {
+ FreePool (Ip6String);
return Status;
}
@@ -722,14 +725,15 @@ HttpUrlGetPort (
&ResultLength
);
if (EFI_ERROR (Status)) {
- return Status;
+ goto ON_EXIT;
}
PortString[ResultLength] = '\0';
while (Index < ResultLength) {
if (!NET_IS_DIGIT (PortString[Index])) {
- return EFI_INVALID_PARAMETER;
+ Status = EFI_INVALID_PARAMETER;
+ goto ON_EXIT;
}
Index ++;
}
@@ -737,10 +741,14 @@ HttpUrlGetPort (
Status = AsciiStrDecimalToUintnS (Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, &Data);
if (Data > HTTP_URI_PORT_MAX_NUM) {
- return EFI_INVALID_PARAMETER;
+ Status = EFI_INVALID_PARAMETER;
+ goto ON_EXIT;
}
*Port = (UINT16) Data;
+
+ON_EXIT:
+ FreePool (PortString);
return Status;
}
@@ -795,6 +803,7 @@ HttpUrlGetPath (
&ResultLength
);
if (EFI_ERROR (Status)) {
+ FreePool (PathStr);
return Status;
}