Avoid HeapReAlloc of a NULL pointer.

This commit is contained in:
Oleg Prokhorov 2003-10-09 19:49:05 +00:00 committed by Alexandre Julliard
parent 64ed084e67
commit 947c61e4f7
3 changed files with 19 additions and 4 deletions

View File

@ -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!");

View File

@ -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;

View File

@ -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;
}