From c61e296b7323dca43dd6c8e56fe55e3d8b415fed Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Mon, 27 Feb 2012 17:17:31 +0000 Subject: [PATCH] [NTOSKRNL]: Don't assert if there's no VAD found in NtFreeVirtualMemory... perhaps a wrong address was used on purpose (such as during a Winetest). Simply do what ROS does when a MAREA is not found and return failure. However if a VAD *was* found, keep all the other ASSERTs... svn path=/trunk/; revision=55886 --- reactos/ntoskrnl/mm/anonmem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reactos/ntoskrnl/mm/anonmem.c b/reactos/ntoskrnl/mm/anonmem.c index 3ccaf22c1a5..fc81ff81dd3 100644 --- a/reactos/ntoskrnl/mm/anonmem.c +++ b/reactos/ntoskrnl/mm/anonmem.c @@ -1149,6 +1149,12 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle, StartingAddress = (ULONG_PTR)PAGE_ALIGN(PBaseAddress); EndingAddress = ((ULONG_PTR)PBaseAddress + PRegionSize - 1) | (PAGE_SIZE - 1); Vad = MiLocateAddress((PVOID)StartingAddress); + if (!Vad) + { + DPRINT1("Unable to VAD for address 0x%p\n", BaseAddress); + Status = STATUS_UNABLE_TO_FREE_VM; + goto unlock_deref_and_return; + } /* This is the kind of VAD we expect right now */ ASSERT(Vad);