public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiaxin Wu <jiaxin.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Wu Hao A <hao.a.wu@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: Add check to avoid use NULL pointer
Date: Fri, 27 Oct 2017 10:23:44 +0800	[thread overview]
Message-ID: <1509071025-38548-2-git-send-email-jiaxin.wu@intel.com> (raw)
In-Reply-To: <1509071025-38548-1-git-send-email-jiaxin.wu@intel.com>

Cc: Wu Hao A <hao.a.wu@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/HttpBootDxe.c | 50 +++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.c b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
index b1f9042..8a61f51 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDxe.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
@@ -613,23 +613,25 @@ HttpBootIp4DxeDriverBindingStart (
   }
   
   return EFI_SUCCESS;
     
 ON_ERROR:
-  if (FirstStart) {
-    gBS->UninstallProtocolInterface (
-           ControllerHandle,
-           &gEfiCallerIdGuid,
-           &Private->Id
-           );
-  }
-  
-  HttpBootDestroyIp4Children (This, Private);
-  HttpBootConfigFormUnload (Private);
+  if (Private != NULL) {
+    if (FirstStart) {
+      gBS->UninstallProtocolInterface (
+             ControllerHandle,
+             &gEfiCallerIdGuid,
+             &Private->Id
+             );
+    }
+    
+    HttpBootDestroyIp4Children (This, Private);
+    HttpBootConfigFormUnload (Private);
 
-  if (FirstStart && Private != NULL) {
-    FreePool (Private);
+    if (FirstStart) {
+      FreePool (Private);
+    }
   }
 
   return Status;
 }
 
@@ -1142,23 +1144,25 @@ HttpBootIp6DxeDriverBindingStart (
   }
 
   return EFI_SUCCESS;
    
 ON_ERROR:
-  if (FirstStart) {
-    gBS->UninstallProtocolInterface (
-           ControllerHandle,
-           &gEfiCallerIdGuid,
-           &Private->Id
-           );
-  }
+  if (Private != NULL) {
+    if (FirstStart) {
+      gBS->UninstallProtocolInterface (
+             ControllerHandle,
+             &gEfiCallerIdGuid,
+             &Private->Id
+             );
+    }
 
-  HttpBootDestroyIp6Children(This, Private);
-  HttpBootConfigFormUnload (Private);
+    HttpBootDestroyIp6Children(This, Private);
+    HttpBootConfigFormUnload (Private);
 
-  if (FirstStart && Private != NULL) {
-    FreePool (Private);
+    if (FirstStart) {
+      FreePool (Private);
+    }
   }
 
   return Status;
 }
 
-- 
1.9.5.msysgit.1



  reply	other threads:[~2017-10-27  2:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27  2:23 [Patch 0/2] Add check to avoid use NULL pointer Jiaxin Wu
2017-10-27  2:23 ` Jiaxin Wu [this message]
2017-10-27  2:23 ` [Patch 2/2] NetworkPkg/IScsiDxe: " Jiaxin Wu
2017-10-27  3:24 ` [Patch 0/2] " Wu, Hao A

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=1509071025-38548-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