summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Application
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2017-05-11 17:34:34 +0800
committerStar Zeng <star.zeng@intel.com>2017-05-12 13:07:11 +0800
commitfb1c81a1e5d299c0cb0783cbfe7e727202c2c471 (patch)
tree6bb54ebeade7dcf377d35f466da717ab551c61bf /MdeModulePkg/Application
parent8bb61740d47b0788bc313f113cbad4a78b55101e (diff)
downloadedk2-fb1c81a1e5d299c0cb0783cbfe7e727202c2c471.tar.gz
edk2-fb1c81a1e5d299c0cb0783cbfe7e727202c2c471.tar.bz2
edk2-fb1c81a1e5d299c0cb0783cbfe7e727202c2c471.zip
MdeModulePkg SmiHandlerProfile: Fix memory leak in DumpSmiChildContext
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=530 In DumpSmiChildContext() of SmiHandlerProfile.c and SmiHandlerProfileInfo.c, the return buffer from ConvertDevicePathToText() should be freed after used. Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg/Application')
-rw-r--r--MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
index 84a1c8ee53..2419cd2959 100644
--- a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
+++ b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
@@ -535,6 +535,8 @@ DumpSmiChildContext (
IN UINTN ContextSize
)
{
+ CHAR16 *Str;
+
if (CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) {
Print(L" SwSmi=\"0x%x\"", ((EFI_SMM_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue);
} else if (CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) {
@@ -555,7 +557,11 @@ DumpSmiChildContext (
Print(L" IoTrapType=\"%a\"", IoTrapTypeToString(((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type));
} else if (CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) {
Print(L" UsbType=\"0x%x\"", UsbTypeToString(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type));
- Print(L" UsbDevicePath=\"%s\"", ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE));
+ Str = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE);
+ Print(L" UsbDevicePath=\"%s\"", Str);
+ if (Str != NULL) {
+ FreePool (Str);
+ }
} else {
Print(L" Context=\"");
InternalDumpData (Context, ContextSize);