From 14e7febc52a2dc33e65ec85862867149aea0d5eb Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Tue, 4 Apr 2017 14:52:14 +0200 Subject: [PATCH] kernel32/tests: Test HeapReAlloc with size 0. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- dlls/kernel32/tests/heap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index 2f7edc823c0..0acf109dff0 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -118,6 +118,13 @@ static void test_heap(void) HeapFree(GetProcessHeap(), 0, mem); mem = HeapAlloc(GetProcessHeap(), 0, ~(SIZE_T)0); ok(mem == NULL, "memory allocated for size ~0\n"); + mem = HeapAlloc(GetProcessHeap(), 0, 17); + msecond = HeapReAlloc(GetProcessHeap(), 0, mem, 0); + ok(msecond != NULL, "HeapReAlloc(0) should have succeeded\n"); + size = HeapSize(GetProcessHeap(), 0, msecond); + ok(size == 0 || broken(size == 1) /* some vista and win7 */, + "HeapSize should have returned 0 instead of %lu\n", size); + HeapFree(GetProcessHeap(), 0, msecond); /* large blocks must be 16-byte aligned */ mem = HeapAlloc(GetProcessHeap(), 0, 512 * 1024);