\r
#include "DxeMain.h"\r
#include "Gcd.h"\r
+#include "Mem/HeapGuard.h"\r
\r
#define MINIMUM_INITIAL_MEMORY_SIZE 0x10000\r
\r
IN OUT EFI_GCD_MAP_ENTRY **BottomEntry\r
)\r
{\r
+ //\r
+ // Set to mOnGuarding to TRUE before memory allocation. This will make sure\r
+ // that the entry memory is not "guarded" by HeapGuard. Otherwise it might\r
+ // cause problem when it's freed (if HeapGuard is enabled).\r
+ //\r
+ mOnGuarding = TRUE;\r
*TopEntry = AllocateZeroPool (sizeof (EFI_GCD_MAP_ENTRY));\r
+ mOnGuarding = FALSE;\r
if (*TopEntry == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
+ mOnGuarding = TRUE;\r
*BottomEntry = AllocateZeroPool (sizeof (EFI_GCD_MAP_ENTRY));\r
+ mOnGuarding = FALSE;\r
if (*BottomEntry == NULL) {\r
CoreFreePool (*TopEntry);\r
return EFI_OUT_OF_RESOURCES;\r