summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2015-12-23 05:36:10 +0000
committershenshushi <shenshushi@Edk2>2015-12-23 05:36:10 +0000
commit5772d0f540cd770dccb37c8742f173c57109bea7 (patch)
tree380499f5324e329829895c9ace4481e455b0ab42 /ShellPkg
parent689b78c890bec8f8345ed03b0ef48133d8450ebf (diff)
downloadedk2-platforms-5772d0f540cd770dccb37c8742f173c57109bea7.tar.xz
ShellPkg: Fix memory leak in SimpleTextOutput on file.
Free 'SimpleTextOut->Mode' buffer before 'SimpleTextOut' is free. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19480 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Application/Shell/ConsoleWrappers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ShellPkg/Application/Shell/ConsoleWrappers.c b/ShellPkg/Application/Shell/ConsoleWrappers.c
index 04a7513a33..46af141eba 100644
--- a/ShellPkg/Application/Shell/ConsoleWrappers.c
+++ b/ShellPkg/Application/Shell/ConsoleWrappers.c
@@ -484,7 +484,8 @@ CreateSimpleTextOutOnFile(
*HandleLocation = ProtocolToReturn->TheHandle;
return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)ProtocolToReturn);
} else {
- FreePool(ProtocolToReturn);
+ SHELL_FREE_NON_NULL(ProtocolToReturn->SimpleTextOut.Mode);
+ SHELL_FREE_NON_NULL(ProtocolToReturn);
return (NULL);
}
}
@@ -511,6 +512,7 @@ CloseSimpleTextOutOnFile(
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->TheHandle,
&gEfiSimpleTextOutProtocolGuid,
&(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->SimpleTextOut));
+ FreePool(SimpleTextOut->Mode);
FreePool(SimpleTextOut);
return (Status);
}