diff --git a/dlls/kernel/ne_segment.c b/dlls/kernel/ne_segment.c index 3a28371b781..0a16d8955b5 100644 --- a/dlls/kernel/ne_segment.c +++ b/dlls/kernel/ne_segment.c @@ -824,11 +824,17 @@ struct ne_init_list static void add_to_init_list( struct ne_init_list *list, NE_MODULE *hModule ) { + NE_MODULE **newModule = NULL; if ( list->count == list->size ) { int newSize = list->size + 128; - NE_MODULE **newModule = HeapReAlloc( GetProcessHeap(), 0, + + if (list->module) + newModule = HeapReAlloc( GetProcessHeap(), 0, list->module, newSize*sizeof(NE_MODULE *) ); + else + newModule = HeapAlloc( GetProcessHeap(), 0, + newSize*sizeof(NE_MODULE *) ); if ( !newModule ) { FIXME_(dll)("Out of memory!"); diff --git a/dlls/winedos/vga.c b/dlls/winedos/vga.c index dfa5fcfe674..bf3580ac33b 100644 --- a/dlls/winedos/vga.c +++ b/dlls/winedos/vga.c @@ -665,9 +665,13 @@ void VGA_PrepareVideoMemCopy(unsigned Xres, unsigned Yres) /* * Allocate space for char + attr. */ - vga_text_old = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - vga_text_old, Xres * Yres * 2 ); + if (vga_text_old) + vga_text_old = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + vga_text_old, Xres * Yres * 2 ); + else + vga_text_old = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + Xres * Yres * 2 ); p = VGA_AlphaBuffer(); p2 = vga_text_old; diff --git a/files/directory.c b/files/directory.c index 8734a98ce13..2e05ca48a1b 100644 --- a/files/directory.c +++ b/files/directory.c @@ -723,7 +723,12 @@ static BOOL DIR_SearchSemicolonedPaths(LPCWSTR name, DOS_FULL_NAME *full_name, L if (newlen > currlen) { - if (!(buffer = HeapReAlloc( GetProcessHeap(), 0, buffer, newlen * sizeof(WCHAR)))) + if (buffer) + buffer = HeapReAlloc( GetProcessHeap(), 0, buffer, newlen * sizeof(WCHAR)); + else + buffer = HeapAlloc( GetProcessHeap(), 0, newlen * sizeof(WCHAR)); + + if(!buffer) goto done; currlen = newlen; }