Reviewed-by: Jaben Carsey <[email protected]> > -----Original Message----- > From: Qiu, Shumin > Sent: Monday, December 21, 2015 7:19 AM > To: [email protected] > Cc: Qiu, Shumin <[email protected]>; Carsey, Jaben > <[email protected]>; Ni, Ruiyu <[email protected]> > Subject: [PATCH v2 1/4] ShellPkg: Fix memory leak in SimpleTextOutput on file. > Importance: High > > Free 'SimpleTextOut->Mode' buffer before 'SimpleTextOut' is free. > > Cc: Jaben Carsey <[email protected]> > Cc: Ruiyu Ni <[email protected]> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Qiu Shumin <[email protected]> > Reviewed-by: Ruiyu Ni <[email protected]> > --- > ShellPkg/Application/Shell/ConsoleWrappers.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/ShellPkg/Application/Shell/ConsoleWrappers.c > b/ShellPkg/Application/Shell/ConsoleWrappers.c > index 04a7513..46af141 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); > } > -- > 1.9.5.msysgit.1
_______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

