diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2015-12-25 02:08:54 +0000 |
---|---|---|
committer | hwu1225 <hwu1225@Edk2> | 2015-12-25 02:08:54 +0000 |
commit | 74670513bdac1d3200c086f22286d0976df72b8a (patch) | |
tree | bb34a63291d4444b74420606bb903831aaf3a77f /ShellPkg/Application | |
parent | 906952ec699878ea73ad3f6611b1d59fea087a8a (diff) | |
download | edk2-platforms-74670513bdac1d3200c086f22286d0976df72b8a.tar.xz |
ShellPkg: Fix memory leak in SimpleTextOutput on file.
Free 'SimpleTextOut->Mode' buffer before 'SimpleTextOut' is free.
(Sync patch r19480 from main trunk.)
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/branches/UDK2015@19530 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Application')
-rw-r--r-- | ShellPkg/Application/Shell/ConsoleWrappers.c | 4 |
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);
}
|