summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2017-05-02 15:55:04 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2017-05-03 10:41:03 +0800
commit00324f3fce83b8d813ca3ec6b6eb663a88a8675e (patch)
tree00d45177b2c7a123bcf0f2e63a35b0a13018da07 /ShellPkg
parent91cdd20f70c5bc739ef45b13e08ae662fbbc55cf (diff)
downloadedk2-00324f3fce83b8d813ca3ec6b6eb663a88a8675e.tar.gz
edk2-00324f3fce83b8d813ca3ec6b6eb663a88a8675e.tar.bz2
edk2-00324f3fce83b8d813ca3ec6b6eb663a88a8675e.zip
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>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c4
1 files changed, 3 insertions, 1 deletions
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
//