[NTDLL_APITEST]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 24 Dec 2011 10:26:04 +0000 (10:26 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 24 Dec 2011 10:26:04 +0000 (10:26 +0000)
- NtAllocateVirtualMemory: fix handling of an error condition; check that newly-committed memory is zeroed

svn path=/trunk/; revision=54748

rostests/apitests/ntdll/NtAllocateVirtualMemory.c

index 2696485..472190b 100644 (file)
@@ -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;