Revision: 19480
http://sourceforge.net/p/edk2/code/19480
Author: shenshushi
Date: 2015-12-23 05:36:10 +0000 (Wed, 23 Dec 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Modified Paths:
--------------
trunk/edk2/ShellPkg/Application/Shell/ConsoleWrappers.c
Modified: trunk/edk2/ShellPkg/Application/Shell/ConsoleWrappers.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/ConsoleWrappers.c 2015-12-23
02:34:19 UTC (rev 19479)
+++ trunk/edk2/ShellPkg/Application/Shell/ConsoleWrappers.c 2015-12-23
05:36:10 UTC (rev 19480)
@@ -484,7 +484,8 @@
*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 @@
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->TheHandle,
&gEfiSimpleTextOutProtocolGuid,
&(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->SimpleTextOut));
+ FreePool(SimpleTextOut->Mode);
FreePool(SimpleTextOut);
return (Status);
}
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits