Revision: 19530
http://sourceforge.net/p/edk2/code/19530
Author: hwu1225
Date: 2015-12-25 02:08:54 +0000 (Fri, 25 Dec 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Revision Links:
--------------
http://sourceforge.net/p/edk2/code/19480
Modified Paths:
--------------
branches/UDK2015/ShellPkg/Application/Shell/ConsoleWrappers.c
Modified: branches/UDK2015/ShellPkg/Application/Shell/ConsoleWrappers.c
===================================================================
--- branches/UDK2015/ShellPkg/Application/Shell/ConsoleWrappers.c
2015-12-25 01:52:56 UTC (rev 19529)
+++ branches/UDK2015/ShellPkg/Application/Shell/ConsoleWrappers.c
2015-12-25 02:08:54 UTC (rev 19530)
@@ -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