mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
689b78c890
commit
5772d0f540
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue