]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
SourceLevelDebugPkg: Fix calculate the checksum bug and add NULL pointer check
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugAgent / SecPeiDebugAgent / SecPeiDebugAgentLib.c
index b718e82e2094c748e8f60c8c11892b31d3d68d69..ec389c7e8b9d0d9b4d5ea986ce7482c1e14a2612 100644 (file)
@@ -522,6 +522,10 @@ InitializeDebugAgent (
     // Build mailbox in HOB and setup Mailbox Set In Pei flag\r
     //\r
     Mailbox = AllocateZeroPool (sizeof (DEBUG_AGENT_MAILBOX));\r
+    if (Mailbox == NULL) {\r
+      DEBUG ((EFI_D_ERROR, "DebugAgent: Failed to allocate memory!\n"));\r
+      CpuDeadLoop ();\r
+    }\r
     MailboxLocation = (UINT64)(UINTN)Mailbox;\r
     MailboxLocationPointer = BuildGuidDataHob (\r
                                &gEfiDebugAgentGuid,\r