// FV does not contains extension header, then produce MEMMAP_DEVICE_PATH\r
//\r
FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplate);\r
+ if (FvbDev->DevicePath == NULL) {\r
+ FreePool (FvbDev);\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
((FV_MEMMAP_DEVICE_PATH *) FvbDev->DevicePath)->MemMapDevPath.StartingAddress = BaseAddress;\r
((FV_MEMMAP_DEVICE_PATH *) FvbDev->DevicePath)->MemMapDevPath.EndingAddress = BaseAddress + FwVolHeader->FvLength - 1;\r
} else {\r
// FV contains extension header, then produce MEDIA_FW_VOL_DEVICE_PATH\r
//\r
FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate);\r
+ if (FvbDev->DevicePath == NULL) {\r
+ FreePool (FvbDev);\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
CopyGuid (\r
&((FV_PIWG_DEVICE_PATH *)FvbDev->DevicePath)->FvDevPath.FvName, \r
(GUID *)(UINTN)(BaseAddress + FwVolHeader->ExtHeaderOffset)\r