Reviewed-by: Ye Ting <[email protected]> 

-----Original Message-----
From: Fu, Siyuan 
Sent: Thursday, May 05, 2016 10:16 AM
To: [email protected]
Cc: Ye, Ting <[email protected]>; Wu, Jiaxin <[email protected]>
Subject: [Patch] NetworkPkg: Fix a memory leak in HTTP boot driver.

We always need to call EfiBootManagerFreeLoadOption because the memory 
allocated for NewOption (description and device path) is no longer needed.

Cc: Ye Ting <[email protected]>
Cc: Wu Jiaxin <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <[email protected]>
---
 NetworkPkg/HttpBootDxe/HttpBootConfig.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootConfig.c 
b/NetworkPkg/HttpBootDxe/HttpBootConfig.c
index 2ca38b5..04c2f3e 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootConfig.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootConfig.c
@@ -142,9 +142,7 @@ HttpBootAddBootOption (
   }
 
   Status = EfiBootManagerAddLoadOptionVariable (&NewOption, (UINTN) -1);
-  if (EFI_ERROR (Status)) {
-    EfiBootManagerFreeLoadOption (&NewOption);
-  }
+  EfiBootManagerFreeLoadOption (&NewOption);
 
 ON_EXIT:
 
--
2.7.4.windows.1

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

Reply via email to