summaryrefslogtreecommitdiff
path: root/Core
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2017-05-02 15:55:04 +0800
committerGuo Mang <mang.guo@intel.com>2017-07-12 11:24:34 +0800
commit68d17ef8ead0b74f04db614ffb1ff225767c1919 (patch)
tree79f80733bc170b9d24a41bc4865237e723275cb0 /Core
parentb37fd4fe338001258e953978f679d3473cff40f8 (diff)
downloadedk2-platforms-68d17ef8ead0b74f04db614ffb1ff225767c1919.tar.xz
ShellPkg/UefiHandleParsingLib: Fix memory leak
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit 00324f3fce83b8d813ca3ec6b6eb663a88a8675e)
Diffstat (limited to 'Core')
-rw-r--r--Core/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Core/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/Core/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index c368d8cb21..da1d92fd17 100644
--- a/Core/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/Core/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
//