diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2017-05-02 15:55:04 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2017-05-03 10:41:03 +0800 |
commit | 00324f3fce83b8d813ca3ec6b6eb663a88a8675e (patch) | |
tree | 00d45177b2c7a123bcf0f2e63a35b0a13018da07 /ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | |
parent | 91cdd20f70c5bc739ef45b13e08ae662fbbc55cf (diff) | |
download | edk2-00324f3fce83b8d813ca3ec6b6eb663a88a8675e.zip edk2-00324f3fce83b8d813ca3ec6b6eb663a88a8675e.tar.gz edk2-00324f3fce83b8d813ca3ec6b6eb663a88a8675e.tar.bz2 |
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/Library/UefiHandleParsingLib/UefiHandleParsingLib.c')
-rw-r--r-- | ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index c368d8c..da1d92f 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
//
|