Add some error checking.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10661 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
xdu2 2010-07-19 05:21:27 +00:00
parent 4cf7e0380e
commit 90bfa227ee
2 changed files with 11 additions and 4 deletions

View File

@ -1134,6 +1134,7 @@ typedef enum {
@retval EFI_SUCCESS The operation was sucessful.
@retval EFI_UNSUPPORTED The operation is not supported as requested.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@return other The operation failed.
**/
EFI_STATUS

View File

@ -623,7 +623,7 @@ ShellOpenFileByName(
//
ASSERT(mEfiShellEnvironment2 != NULL);
FilePath = mEfiShellEnvironment2->NameToPath ((CHAR16*)FileName);
if (FileDevicePath != NULL) {
if (FilePath != NULL) {
return (ShellOpenFileByDevicePath(&FilePath,
&DeviceHandle,
FileHandle,
@ -1522,6 +1522,10 @@ ShellFindFilePath (
Size = StrSize(Path);
Size += StrSize(FileName);
TestPath = AllocateZeroPool(Size);
ASSERT(TestPath != NULL);
if (TestPath == NULL) {
return (NULL);
}
Walker = (CHAR16*)Path;
do {
CopyMem(TestPath, Walker, StrSize(Walker));
@ -1594,9 +1598,7 @@ ShellFindFilePathEx (
}
for (ExtensionWalker = FileExtension, TempChar2 = (CHAR16*)FileExtension; TempChar2 != NULL ; ExtensionWalker = TempChar2 + 1 ){
StrCpy(TestPath, FileName);
if (ExtensionWalker != NULL) {
StrCat(TestPath, ExtensionWalker);
}
StrCat(TestPath, ExtensionWalker);
TempChar = StrStr(TestPath, L";");
if (TempChar != NULL) {
*TempChar = CHAR_NULL;
@ -2850,6 +2852,7 @@ StrnCatGrow (
@retval EFI_SUCCESS The operation was sucessful.
@retval EFI_UNSUPPORTED The operation is not supported as requested.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@return other The operation failed.
**/
EFI_STATUS
@ -2867,6 +2870,9 @@ ShellPromptForResponse (
Status = EFI_SUCCESS;
Resp = (SHELL_PROMPT_RESPONSE*)AllocatePool(sizeof(SHELL_PROMPT_RESPONSE));
if (Resp == NULL) {
return EFI_OUT_OF_RESOURCES;
}
switch(Type) {
case SHELL_PROMPT_REQUEST_TYPE_QUIT_CONTINUE: