]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access
authorLiming Gao <liming.gao@intel.com>
Tue, 2 Aug 2016 05:37:55 +0000 (13:37 +0800)
committerLiming Gao <liming.gao@intel.com>
Wed, 3 Aug 2016 07:20:50 +0000 (15:20 +0800)
Check NULL pointer before access it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c

index 9eea50dd33fdf9debc6ad2277864bc664924683e..18a07d86b7edcc4c5c97bcc4b5bd0c1e2c7edd2c 100644 (file)
@@ -345,6 +345,9 @@ FvNotificationEvent (
   Index      = 0;\r
   BufferSize = sizeof (EFI_HANDLE);\r
   Handle     = AllocateZeroPool (BufferSize);\r
+  if (Handle == NULL) {\r
+    return;\r
+  }\r
   Status = gBS->LocateHandle (\r
                     ByProtocol,\r
                     &gEfiFirmwareVolume2ProtocolGuid,\r
@@ -355,6 +358,9 @@ FvNotificationEvent (
   if (EFI_BUFFER_TOO_SMALL == Status) {\r
     FreePool (Handle);\r
     Handle = AllocateZeroPool (BufferSize);\r
+    if (Handle == NULL) {\r
+      return;\r
+    }\r
     Status = gBS->LocateHandle (\r
                     ByProtocol,\r
                     &gEfiFirmwareVolume2ProtocolGuid,\r