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 00324f3fce)
This commit is contained in:
Ruiyu Ni
2017-05-02 15:55:04 +08:00
parent 7ff98a2f77
commit 929246cc03

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