summaryrefslogtreecommitdiff
path: root/ShellPkg/Application/Shell/ConsoleLogger.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Application/Shell/ConsoleLogger.c')
-rw-r--r--ShellPkg/Application/Shell/ConsoleLogger.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ShellPkg/Application/Shell/ConsoleLogger.c b/ShellPkg/Application/Shell/ConsoleLogger.c
index 2b84d87adb..4b237bf6e9 100644
--- a/ShellPkg/Application/Shell/ConsoleLogger.c
+++ b/ShellPkg/Application/Shell/ConsoleLogger.c
@@ -76,10 +76,19 @@ ConsoleLoggerInstall(
Status = ConsoleLoggerResetBuffers(*ConsoleInfo);
if (EFI_ERROR(Status)) {
+ SHELL_FREE_NON_NULL((*ConsoleInfo));
+ *ConsoleInfo = NULL;
return (Status);
}
Status = gBS->InstallProtocolInterface(&gImageHandle, &gEfiSimpleTextOutProtocolGuid, EFI_NATIVE_INTERFACE, (VOID*)&((*ConsoleInfo)->OurConOut));
+ if (EFI_ERROR(Status)) {
+ SHELL_FREE_NON_NULL((*ConsoleInfo)->Buffer);
+ SHELL_FREE_NON_NULL((*ConsoleInfo)->Attributes);
+ SHELL_FREE_NON_NULL((*ConsoleInfo));
+ *ConsoleInfo = NULL;
+ return (Status);
+ }
(*ConsoleInfo)->OldConOut = gST->ConOut;
(*ConsoleInfo)->OldConHandle = gST->ConsoleOutHandle;