Memory allocated with NtAllocateVirtualMemory should be freed with NtFreeVirtualMemory, for consistency.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/kernel32/tests/virtual.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index 474955630fd..dcaeb147b04 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -454,7 +454,12 @@ static void test_VirtualAlloc(void) MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); todo_wine ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status); - if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n"); + if (status == STATUS_SUCCESS) + { + size = 0; + status = pNtFreeVirtualMemory(GetCurrentProcess(), &addr2, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "pNtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); + }
/* 21 zero bits is valid */ size = 0x1000; @@ -463,7 +468,12 @@ static void test_VirtualAlloc(void) MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY, "NtAllocateVirtualMemory returned %08x\n", status); - if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n"); + if (status == STATUS_SUCCESS) + { + size = 0; + status = pNtFreeVirtualMemory(GetCurrentProcess(), &addr2, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "pNtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); + }
/* 22 zero bits is invalid */ size = 0x1000; @@ -471,7 +481,12 @@ static void test_VirtualAlloc(void) status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 22, &size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); ok(status == STATUS_INVALID_PARAMETER_3, "NtAllocateVirtualMemory returned %08x\n", status); - if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n"); + if (status == STATUS_SUCCESS) + { + size = 0; + status = pNtFreeVirtualMemory(GetCurrentProcess(), &addr2, &size, MEM_RELEASE); + ok(status == STATUS_SUCCESS, "pNtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2); + }
/* AT_ROUND_TO_PAGE flag is not supported for VirtualAlloc */ SetLastError(0xdeadbeef);