summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c
index d581a33..ea190d0 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiCompress.c
@@ -48,6 +48,7 @@ ShellCommandRunEfiCompress (
InShellFileHandle = NULL;
OutShellFileHandle = NULL;
InBuffer = NULL;
+ Package = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
@@ -79,10 +80,16 @@ ShellCommandRunEfiCompress (
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
TempParam = ShellCommandLineGetRawValue (Package, 1);
- ASSERT (TempParam != NULL);
+ if (TempParam == NULL) {
+ ASSERT (TempParam != NULL);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"eficompress");
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ goto Exit;
+ }
+
InFileName = ShellFindFilePath (TempParam);
OutFileName = ShellCommandLineGetRawValue (Package, 2);
- if (InFileName == NULL) {
+ if ((InFileName == NULL) || (OutFileName == NULL)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"eficompress", TempParam);
ShellStatus = SHELL_NOT_FOUND;
} else {
@@ -150,6 +157,11 @@ ShellCommandRunEfiCompress (
ShellCommandLineFreeVarList (Package);
}
+Exit:
+ if ((ShellStatus != SHELL_SUCCESS) && (Package != NULL)) {
+ ShellCommandLineFreeVarList (Package);
+ }
+
if (InShellFileHandle != NULL) {
gEfiShellProtocol->CloseFile (InShellFileHandle);
}