From 3bcfb90188ac02fae7a68742eafb8e3b91bd7c5b Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sat, 24 Jun 2000 12:51:24 +0000 Subject: [PATCH] Fixed some OOM conditions in GlobalAlloc. --- memory/global.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/memory/global.c b/memory/global.c index 39db955a341..6d716424aa1 100644 --- a/memory/global.c +++ b/memory/global.c @@ -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); } -- 2.11.4.GIT