mirror of https://github.com/acidanthera/audk.git
ShellPkg/Mv: Handle memory allocation failure
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
parent
0b34dc1324
commit
28d447f9bd
|
@ -736,11 +736,15 @@ ShellCommandRunMv (
|
||||||
//
|
//
|
||||||
CwdSize = StrSize(ShellGetCurrentDir(NULL)) + sizeof(CHAR16);
|
CwdSize = StrSize(ShellGetCurrentDir(NULL)) + sizeof(CHAR16);
|
||||||
Cwd = AllocateZeroPool(CwdSize);
|
Cwd = AllocateZeroPool(CwdSize);
|
||||||
ASSERT (Cwd != NULL);
|
if (Cwd == NULL) {
|
||||||
StrCpyS(Cwd, CwdSize/sizeof(CHAR16), ShellGetCurrentDir(NULL));
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle, L"mv");
|
||||||
StrCatS(Cwd, CwdSize/sizeof(CHAR16), L"\\");
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
ShellStatus = ValidateAndMoveFiles(FileList, &Response, Cwd);
|
} else {
|
||||||
FreePool(Cwd);
|
StrCpyS (Cwd, CwdSize / sizeof (CHAR16), ShellGetCurrentDir (NULL));
|
||||||
|
StrCatS (Cwd, CwdSize / sizeof (CHAR16), L"\\");
|
||||||
|
ShellStatus = ValidateAndMoveFiles (FileList, &Response, Cwd);
|
||||||
|
FreePool (Cwd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue