]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add check to the allocated pool.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 11 Mar 2009 02:53:15 +0000 (02:53 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 11 Mar 2009 02:53:15 +0000 (02:53 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7861 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
MdeModulePkg/Core/Pei/FwVol/FwVol.c

index 02b8914ff82ea767295775d21a1caea43013332c..9b7b166a9949596c3c8bf649835fa772d777b2d5 100644 (file)
@@ -513,6 +513,10 @@ ProduceFVBProtocolOnBuffer (
     // 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
@@ -520,6 +524,10 @@ ProduceFVBProtocolOnBuffer (
     // 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
index d4162057e74fcf95585c2b54c10d47e950f6e3fc..2e78e51936016f9b1edc64c5b850ba96a1bbaa0b 100644 (file)
@@ -935,7 +935,7 @@ ProcessFvFile (
   BuildFvHob (\r
     (EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart,\r
     FvImageInfo.FvSize\r
-  );\r
+    );\r
 \r
   //\r
   // Makes the encapsulated volume show up in DXE phase to skip processing of\r