GlobalReAlloc returns 0 on failure.

This commit is contained in:
Huw D M Davies 2000-04-13 15:57:06 +00:00 committed by Alexandre Julliard
parent e529d36010
commit c43fdb75b3
1 changed files with 7 additions and 4 deletions

View File

@ -1251,14 +1251,17 @@ HGLOBAL WINAPI GlobalReAlloc(
hnew=hmem;
if(pintern->Pointer)
{
palloc=HeapReAlloc(heap, heap_flags,
(char *) pintern->Pointer-sizeof(HGLOBAL),
size+sizeof(HGLOBAL) );
if((palloc = HeapReAlloc(heap, heap_flags,
(char *) pintern->Pointer-sizeof(HGLOBAL),
size+sizeof(HGLOBAL))) == NULL)
return 0; /* Block still valid */
pintern->Pointer=(char *) palloc+sizeof(HGLOBAL);
}
else
{
palloc=HeapAlloc(heap, heap_flags, size+sizeof(HGLOBAL));
if((palloc=HeapAlloc(heap, heap_flags, size+sizeof(HGLOBAL)))
== NULL)
return 0;
*(HGLOBAL *)palloc=hmem;
pintern->Pointer=(char *) palloc+sizeof(HGLOBAL);
}