From ca00c95ea5d42141b28c2dafd4135dc09a4ddb53 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 8 Oct 2014 00:30:37 +0000 Subject: [PATCH] [NTOSKRNL] Small impovement to NtFreeVirtualMemory to make things clearer svn path=/trunk/; revision=64585 --- reactos/ntoskrnl/mm/ARM3/virtual.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/virtual.c b/reactos/ntoskrnl/mm/ARM3/virtual.c index 91f381aad1f..cbc781d6b20 100644 --- a/reactos/ntoskrnl/mm/ARM3/virtual.c +++ b/reactos/ntoskrnl/mm/ARM3/virtual.c @@ -5134,7 +5134,7 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle, PMEMORY_AREA MemoryArea; SIZE_T PRegionSize; PVOID PBaseAddress; - LONG_PTR CommitReduction = 0; + LONG_PTR AlreadyDecommitted, CommitReduction = 0; ULONG_PTR StartingAddress, EndingAddress; PMMVAD Vad; NTSTATUS Status; @@ -5530,13 +5530,15 @@ FinalPath: // Decommit the PTEs for the range plus the actual backing pages for the // range, then reduce that amount from the commit charge in the VAD // + AlreadyDecommitted = MiDecommitPages((PVOID)StartingAddress, + MiAddressToPte(EndingAddress), + Process, + Vad); CommitReduction = MiAddressToPte(EndingAddress) - MiAddressToPte(StartingAddress) + 1 - - MiDecommitPages((PVOID)StartingAddress, - MiAddressToPte(EndingAddress), - Process, - Vad); + AlreadyDecommitted; + ASSERT(CommitReduction >= 0); Vad->u.VadFlags.CommitCharge -= CommitReduction; ASSERT(Vad->u.VadFlags.CommitCharge >= 0);