Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <[email protected]>
Signed-off-by: Chen A Chen <[email protected]>
Cc: Jaben Carsey <[email protected]>
---
 ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c 
b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index c368d8cb21..da1d92fd17 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -2331,7 +2331,9 @@ ConvertHandleIndexToHandle(
       // Verify that LinkWalker->TheHandle is valid handle
       //
       Status = gBS->ProtocolsPerHandle(ListWalker->TheHandle, &ProtocolBuffer, 
&ProtocolCount);
-      if (EFI_ERROR (Status)) {
+      if (!EFI_ERROR (Status)) {
+        FreePool (ProtocolBuffer);
+      } else {
         //
         // TheHandle is not valid, so do not add to handle list
         //
-- 
2.12.2.windows.2

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

Reply via email to