From: Jiaxin Wu <jiaxin.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Wang Fan <fan.wang@intel.com>, Ye Ting <ting.ye@intel.com>,
Fu Siyuan <siyuan.fu@intel.com>, Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [Patch 1/2] NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen.
Date: Thu, 21 Dec 2017 14:50:46 +0800 [thread overview]
Message-ID: <1513839047-15032-2-git-send-email-jiaxin.wu@intel.com> (raw)
In-Reply-To: <1513839047-15032-1-git-send-email-jiaxin.wu@intel.com>
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>
---
NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 3 +++
NetworkPkg/HttpBootDxe/HttpBootImpl.c | 6 +++++-
2 files changed, 8 insertions(+), 1 deletion(-)
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
@@ -420,10 +420,13 @@ HttpBootParseDhcp4Packet (
} else {
if (!IsProxyOffer) {
OfferType = IsDnsOffer ? HttpOfferTypeDhcpDns : HttpOfferTypeDhcpOnly;
} else {
+ if (Cache4->UriParser != NULL) {
+ FreePool (Cache4->UriParser);
+ }
return EFI_DEVICE_ERROR;
}
}
Cache4->OfferType = OfferType;
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
@@ -120,12 +120,13 @@ HttpBootStart (
)
{
UINTN Index;
EFI_STATUS Status;
CHAR8 *Uri;
-
+ Uri = NULL;
+
if (Private == NULL || FilePath == NULL) {
return EFI_INVALID_PARAMETER;
}
//
@@ -152,10 +153,13 @@ HttpBootStart (
//
// Restart is required, first stop then continue this start function.
//
Status = HttpBootStop (Private);
if (EFI_ERROR (Status)) {
+ if (Uri != NULL) {
+ FreePool (Uri);
+ }
return Status;
}
} else {
//
// Restart is not required.
--
1.9.5.msysgit.1
next prev parent reply other threads:[~2017-12-21 6:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 6:50 [Patch 0/2] Fix some issues in HttpBootDxe driver Jiaxin Wu
2017-12-21 6:50 ` Jiaxin Wu [this message]
2017-12-21 6:50 ` [Patch 2/2] NetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet redirect status Jiaxin Wu
2017-12-22 7:39 ` [Patch 0/2] Fix some issues in HttpBootDxe driver Wang, Fan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513839047-15032-2-git-send-email-jiaxin.wu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox