//\r
if ((ValidIndex + 1) >= TempListLength) {\r
EnlargedTempList = AllocateZeroPool (TempListLength * 2);\r
+ if (EnlargedTempList == NULL) {\r
+ DEBUG ((DEBUG_ERROR, "Fail to allocate memory!\n"));\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
CopyMem (EnlargedTempList, TempList, TempListLength);\r
FreePool (TempList);\r
TempList = EnlargedTempList;\r
// Get SG list entries\r
//\r
Status = GetScatterGatherHeadEntries (&ListLength, &VariableArrayAddress);\r
- if (EFI_ERROR (Status)) {\r
+ if (EFI_ERROR (Status) || VariableArrayAddress == NULL) {\r
DEBUG ((DEBUG_ERROR, "%a failed to get Scatter Gather List Head Entries. Status = %r\n", __FUNCTION__, Status));\r
goto Done;\r
}\r