From 18fcd6a70c87badd6342873d9a034acf4695283d Mon Sep 17 00:00:00 2001 From: lgao4 Date: Wed, 11 Mar 2009 02:53:15 +0000 Subject: Add check to the allocated pool. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7861 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'MdeModulePkg/Core/Dxe/FwVolBlock') diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c index 02b8914ff8..9b7b166a99 100644 --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c @@ -513,6 +513,10 @@ ProduceFVBProtocolOnBuffer ( // FV does not contains extension header, then produce MEMMAP_DEVICE_PATH // FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplate); + if (FvbDev->DevicePath == NULL) { + FreePool (FvbDev); + return EFI_OUT_OF_RESOURCES; + } ((FV_MEMMAP_DEVICE_PATH *) FvbDev->DevicePath)->MemMapDevPath.StartingAddress = BaseAddress; ((FV_MEMMAP_DEVICE_PATH *) FvbDev->DevicePath)->MemMapDevPath.EndingAddress = BaseAddress + FwVolHeader->FvLength - 1; } else { @@ -520,6 +524,10 @@ ProduceFVBProtocolOnBuffer ( // FV contains extension header, then produce MEDIA_FW_VOL_DEVICE_PATH // FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate); + if (FvbDev->DevicePath == NULL) { + FreePool (FvbDev); + return EFI_OUT_OF_RESOURCES; + } CopyGuid ( &((FV_PIWG_DEVICE_PATH *)FvbDev->DevicePath)->FvDevPath.FvName, (GUID *)(UINTN)(BaseAddress + FwVolHeader->ExtHeaderOffset) -- cgit v1.2.3