diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 64967259a2..f4ec48ff67 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -1402,13 +1402,13 @@ CoreFreePages ( ) { EFI_STATUS Status; - - Status = CoreInternalFreePages (Memory, NumberOfPages); - if (!EFI_ERROR (Status)) { - CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePages, 0, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) Memory); - } - return Status; -} + + Status = CoreInternalFreePages (Memory, NumberOfPages); + if (!EFI_ERROR (Status)) { + CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePages, (EFI_MEMORY_TYPE) 0, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) Memory); + } + return Status; +} /** This function checks to see if the last memory map descriptor in a memory map diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c index 1891bb7387..6bf289b38f 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -433,13 +433,13 @@ CoreFreePool ( ) { EFI_STATUS Status; - - Status = CoreInternalFreePool (Buffer); - if (!EFI_ERROR (Status)) { - CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePool, 0, 0, Buffer); - } - return Status; -} + + Status = CoreInternalFreePool (Buffer); + if (!EFI_ERROR (Status)) { + CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePool, (EFI_MEMORY_TYPE) 0, 0, Buffer); + } + return Status; +} /** Internal function to free a pool entry.