diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-12-21 13:32:20 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-12-22 15:50:58 +0800 |
commit | 0dc5929645210604fc5a01bf8c160501cc4d9502 (patch) | |
tree | 3874e36e1518782577499d1b212f38f1c220dbce /NetworkPkg | |
parent | 9c14f76bae256820993e060461bc036b82634700 (diff) | |
download | edk2-0dc5929645210604fc5a01bf8c160501cc4d9502.zip edk2-0dc5929645210604fc5a01bf8c160501cc4d9502.tar.gz edk2-0dc5929645210604fc5a01bf8c160501cc4d9502.tar.bz2 |
NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen.
Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Wang Fan <fan.wang@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r-- | NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 3 | ||||
-rw-r--r-- | NetworkPkg/HttpBootDxe/HttpBootImpl.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c index a8cee04..421ce6e 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c @@ -422,6 +422,9 @@ HttpBootParseDhcp4Packet ( if (!IsProxyOffer) {
OfferType = IsDnsOffer ? HttpOfferTypeDhcpDns : HttpOfferTypeDhcpOnly;
} else {
+ if (Cache4->UriParser != NULL) {
+ FreePool (Cache4->UriParser);
+ }
return EFI_DEVICE_ERROR;
}
}
diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c index 7f0616d..d4b46a6 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c @@ -122,8 +122,9 @@ HttpBootStart ( UINTN Index;
EFI_STATUS Status;
CHAR8 *Uri;
-
+ Uri = NULL;
+
if (Private == NULL || FilePath == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -154,6 +155,9 @@ HttpBootStart ( //
Status = HttpBootStop (Private);
if (EFI_ERROR (Status)) {
+ if (Uri != NULL) {
+ FreePool (Uri);
+ }
return Status;
}
} else {
|