summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Dxe/FwVolBlock
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-11 02:53:15 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-11 02:53:15 +0000
commit18fcd6a70c87badd6342873d9a034acf4695283d (patch)
treeef80b83d70e2505ac70caeb8484f259c306365c4 /MdeModulePkg/Core/Dxe/FwVolBlock
parent1e34ba7e0c0a09e20e294f6041a2212712e6cb77 (diff)
downloadedk2-platforms-18fcd6a70c87badd6342873d9a034acf4695283d.tar.xz
Add check to the allocated pool.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7861 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe/FwVolBlock')
-rw-r--r--MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c8
1 files changed, 8 insertions, 0 deletions
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)