check memory allocations for success.
check pointer before access. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11503 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -2760,7 +2760,7 @@ FileBufferMovePosition (
|
||||
//
|
||||
FileBuffer.FilePosition.Column = NewFilePosCol;
|
||||
if (ColGap < 0) {
|
||||
Abs = -ColGap;
|
||||
Abs = (UINTN)(-ColGap);
|
||||
FileBuffer.DisplayPosition.Column -= Abs;
|
||||
} else {
|
||||
FileBuffer.DisplayPosition.Column += ColGap;
|
||||
|
@ -205,6 +205,10 @@ ShellCommandRunSetVar (
|
||||
Data++;
|
||||
Data++;
|
||||
Buffer = AllocateZeroPool(StrSize(Data));
|
||||
if (Buffer == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle);
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
} else {
|
||||
UnicodeSPrint(Buffer, StrSize(Data), L"%s", Data);
|
||||
((CHAR16*)Buffer)[StrLen(Buffer)-1] = CHAR_NULL;
|
||||
|
||||
@ -215,6 +219,7 @@ ShellCommandRunSetVar (
|
||||
} else {
|
||||
ASSERT(ShellStatus == SHELL_SUCCESS);
|
||||
}
|
||||
}
|
||||
} else if (StrnCmp(Data, L"--", 2) == 0) {
|
||||
//
|
||||
// device path in text format
|
||||
|
@ -565,7 +565,9 @@ ShellCommandRunFor (
|
||||
Info->RemoveSubstAlias = TRUE;
|
||||
}
|
||||
}
|
||||
if (CurrentScriptFile->CurrentCommand != NULL) {
|
||||
CurrentScriptFile->CurrentCommand->Data = Info;
|
||||
}
|
||||
} else {
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
|
Binary file not shown.
@ -113,7 +113,12 @@ HandleVol(
|
||||
Size2 = StrSize(SysInfo->VolumeLabel);
|
||||
if (Size1 > Size2) {
|
||||
SysInfo = ReallocatePool((UINTN)SysInfo->Size, (UINTN)SysInfo->Size + Size1 - Size2, SysInfo);
|
||||
if (SysInfo == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellLevel2HiiHandle);
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
if (SysInfo != NULL) {
|
||||
StrCpy ((CHAR16 *) SysInfo->VolumeLabel, Name);
|
||||
SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + Size1;
|
||||
Status = EfiFpHandle->SetInfo(
|
||||
@ -122,6 +127,7 @@ HandleVol(
|
||||
(UINTN)SysInfo->Size,
|
||||
SysInfo);
|
||||
}
|
||||
}
|
||||
|
||||
FreePool(SysInfo);
|
||||
|
||||
@ -154,6 +160,7 @@ HandleVol(
|
||||
|
||||
ASSERT(SysInfo != NULL);
|
||||
|
||||
if (SysInfo != NULL) {
|
||||
//
|
||||
// print VolumeInfo table
|
||||
//
|
||||
@ -170,6 +177,7 @@ HandleVol(
|
||||
SysInfo->BlockSize
|
||||
);
|
||||
SHELL_FREE_NON_NULL(SysInfo);
|
||||
}
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
Reference in New Issue
Block a user