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>
This commit is contained in:
Ruiyu Ni 2017-05-02 15:55:04 +08:00
parent 91cdd20f70
commit 00324f3fce
1 changed files with 3 additions and 1 deletions

View File

@ -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
//