OK folks, This is it with HeapReAlloc() -- I've finished off the audit list, which means my now all places in the Wine tree where we use HeapReAlloc() or RtlHeapReAllocate() have been either fixed (thanks Oleg!, he did most of the hard work), or checked that they don't pass in a NULL pointer. Another one bites the dust ;) ChangeLog RtlHeapReAllocate() should not allocate memory. Add small test to make sure it doesn't return. Index: dlls/ntdll/heap.c =================================================================== RCS file: /var/cvs/wine/dlls/ntdll/heap.c,v retrieving revision 1.25 diff -u -r1.25 heap.c --- dlls/ntdll/heap.c 10 Oct 2003 00:12:17 -0000 1.25 +++ dlls/ntdll/heap.c 20 Nov 2003 21:00:39 -0000 @@ -1231,11 +1231,11 @@ HEAP *heapPtr; SUBHEAP *subheap; - if (!ptr) return RtlAllocateHeap( heap, flags, size ); /* FIXME: correct? */ + if (!ptr) return NULL; if (!(heapPtr = HEAP_GetPtr( heap ))) { set_status( STATUS_INVALID_HANDLE ); - return FALSE; + return NULL; } /* Validate the parameters */ Index: dlls/ntdll/tests/Makefile.in =================================================================== RCS file: /var/cvs/wine/dlls/ntdll/tests/Makefile.in,v retrieving revision 1.9 diff -u -r1.9 Makefile.in --- dlls/ntdll/tests/Makefile.in 8 May 2003 03:47:24 -0000 1.9 +++ dlls/ntdll/tests/Makefile.in 20 Nov 2003 21:01:07 -0000 @@ -9,6 +9,7 @@ env.c \ error.c \ generated.c \ + heap.c \ large_int.c \ path.c \ rtl.c \ --- /dev/null 2003-01-30 05:24:37.000000000 -0500 +++ dlls/ntdll/tests/heap.c 2003-11-20 16:08:54.000000000 -0500 @@ -0,0 +1,49 @@ +/* + * Unit test suite for heap functions + * + * Copyright 2003 Dimitrie O. Paun + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <stdarg.h> +#include <stdlib.h> + +#include "ntstatus.h" +#include "windef.h" +#include "winbase.h" +#include "wine/test.h" +#include "winnt.h" +#include "winnls.h" +#include "winreg.h" +#include "winternl.h" + +static inline HANDLE ntdll_get_process_heap(void) +{ + return NtCurrentTeb()->Peb->ProcessHeap; +} + +static void test_realloc( void ) +{ + void *mem = NULL; + + mem = RtlReAllocateHeap(ntdll_get_process_heap(), 0, mem, 10); + ok(mem == NULL, "memory allocated"); +} + +START_TEST(heap) +{ + test_realloc(); +} -- Dimi.