]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access
[mirror_edk2.git] / 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