From 42942c9fbe660da35dfd44aab8e1c34cd2f14ee3 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sat, 24 Dec 2011 10:26:04 +0000 Subject: [PATCH] [NTDLL_APITEST] - NtAllocateVirtualMemory: fix handling of an error condition; check that newly-committed memory is zeroed svn path=/trunk/; revision=54748 --- rostests/apitests/ntdll/NtAllocateVirtualMemory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rostests/apitests/ntdll/NtAllocateVirtualMemory.c b/rostests/apitests/ntdll/NtAllocateVirtualMemory.c index 2696485f50b..472190ba295 100644 --- a/rostests/apitests/ntdll/NtAllocateVirtualMemory.c +++ b/rostests/apitests/ntdll/NtAllocateVirtualMemory.c @@ -60,11 +60,13 @@ Allocate( Status = NtAllocateVirtualMemory(NtCurrentProcess(), &FirstPageStart, 0, &Size, MEM_COMMIT, PAGE_READWRITE); if (!NT_SUCCESS(Status)) { - Size = 0; + AllocationSize = 0; Status = NtFreeVirtualMemory(NtCurrentProcess(), &AllocationStart, &AllocationSize, MEM_RELEASE); ASSERT(Status == STATUS_SUCCESS); return NULL; } + ASSERT(Size % sizeof(ULONG) == 0); + ASSERT(RtlCompareMemoryUlong(FirstPageStart, Size, 0) == Size); UserBuffer = AllocationStart; UserBuffer += AllocationSize - PAGE_SIZE - DataSize;