Cc: Wu Hao A <[email protected]>
Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <[email protected]>
---
 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

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to