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-04 15:55:56 +0800 |
commit | 929246cc035331455be9eef1b4b5ef6bcf7b2050 (patch) | |
tree | 65b469483555a4f5ea58620bad0d89af1d4be888 /ShellPkg | |
parent | 7ff98a2f77d8fb357642053c0adaca2de13f2023 (diff) | |
download | edk2-929246cc035331455be9eef1b4b5ef6bcf7b2050.tar.gz edk2-929246cc035331455be9eef1b4b5ef6bcf7b2050.tar.bz2 edk2-929246cc035331455be9eef1b4b5ef6bcf7b2050.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>
(cherry picked from commit 00324f3fce83b8d813ca3ec6b6eb663a88a8675e)
Diffstat (limited to 'ShellPkg')
-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 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
//
|