diff --git a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c index e70d8777d7..b859f63c2b 100644 --- a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c +++ b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c @@ -125,9 +125,10 @@ AllocatePagesFromList ( } // Check if we have found a node that could contain our new allocation if (NewNode != NULL) { - NewNode->Allocated = TRUE; - Node->Allocation = (VOID*)(UINTN)Node->Base; - *Allocation = Node->Allocation; + NewNode->Allocated = TRUE; + NewNode->Allocation = (VOID*)(UINTN)NewNode->Base; + *Allocation = NewNode->Allocation; + mFreedBufferSize -= NewNode->Pages * EFI_PAGE_SIZE; return EFI_SUCCESS; }