diff --git a/Platform/AMD/VanGoghBoard/Override/edk2/Fsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c b/Platform/AMD/VanGoghBoard/Override/edk2/Fsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c index e6a589bcb57..008769cbc1d 100644 --- a/Platform/AMD/VanGoghBoard/Override/edk2/Fsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c +++ b/Platform/AMD/VanGoghBoard/Override/edk2/Fsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c @@ -542,13 +542,20 @@ FspsWrapperInitDispatchMode ( if (BootMode != BOOT_ON_S3_RESUME) { MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi)); - ASSERT (MeasurementExcludedFvPpi != NULL); + if (MeasurementExcludedFvPpi == NULL) { + ASSERT (MeasurementExcludedFvPpi != NULL); + return EFI_OUT_OF_RESOURCES; + } MeasurementExcludedFvPpi->Count = 1; MeasurementExcludedFvPpi->Fv[0].FvBase = PcdGet32 (PcdFspsBaseAddressInMemory); MeasurementExcludedFvPpi->Fv[0].FvLength = PcdGet32 (PcdFspsRegionSize); MeasurementExcludedPpiList = AllocatePool (sizeof (*MeasurementExcludedPpiList)); - ASSERT (MeasurementExcludedPpiList != NULL); + if (MeasurementExcludedPpiList == NULL) { + ASSERT (MeasurementExcludedPpiList != NULL); + FreePool (MeasurementExcludedFvPpi); + return EFI_OUT_OF_RESOURCES; + } MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; MeasurementExcludedPpiList->Guid = &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid; MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi;