Commit 3bcfb901 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Fixed some OOM conditions in GlobalAlloc.

parent e384fa6b
......@@ -1039,9 +1039,13 @@ HGLOBAL WINAPI GlobalAlloc(
/* HeapLock(heap); */
pintern=HeapAlloc(heap, 0, sizeof(GLOBAL32_INTERN));
if (!pintern) return NULL;
if(size)
{
palloc=HeapAlloc(heap, hpflags, size+sizeof(HGLOBAL));
if (!(palloc=HeapAlloc(heap, hpflags, size+sizeof(HGLOBAL)))) {
HeapFree(heap, 0, pintern);
return NULL;
}
*(HGLOBAL *)palloc=INTERN_TO_HANDLE(pintern);
pintern->Pointer=(char *) palloc+sizeof(HGLOBAL);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment