From fa2b0ba8e36b4eb36cbc93a45f82f353a0b161b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=A9=20van=20Geldorp?= Date: Sat, 17 Jan 2004 02:21:42 +0000 Subject: [PATCH] Swap arguments of LocalAlloc and only update Malloc32 block on successful allocation. Fixes bug #154. svn path=/trunk/; revision=7707 --- reactos/lib/ole32/ifs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/reactos/lib/ole32/ifs.c b/reactos/lib/ole32/ifs.c index f4e7c48c91b..7b03600e229 100644 --- a/reactos/lib/ole32/ifs.c +++ b/reactos/lib/ole32/ifs.c @@ -73,10 +73,16 @@ static CRITICAL_SECTION IMalloc32_SpyCS = { &critsect_debug, -1, 0, 0, 0, 0 }; /* resize the old table */ static int SetSpyedBlockTableLength ( int NewLength ) { - if (!Malloc32.SpyedBlocks) Malloc32.SpyedBlocks = (LPVOID*)LocalAlloc(NewLength, GMEM_ZEROINIT); - else Malloc32.SpyedBlocks = (LPVOID*)LocalReAlloc((HLOCAL)Malloc32.SpyedBlocks, NewLength, GMEM_ZEROINIT); - Malloc32.SpyedBlockTableLength = NewLength; - return Malloc32.SpyedBlocks ? 1 : 0; + LPVOID *NewSpyedBlocks; + + if (!Malloc32.SpyedBlocks) NewSpyedBlocks = (LPVOID*)LocalAlloc(GMEM_ZEROINIT, NewLength); + else NewSpyedBlocks = (LPVOID*)LocalReAlloc((HLOCAL)Malloc32.SpyedBlocks, NewLength, GMEM_ZEROINIT); + if (NewSpyedBlocks) { + Malloc32.SpyedBlocks = NewSpyedBlocks; + Malloc32.SpyedBlockTableLength = NewLength; + } + + return NewSpyedBlocks ? 1 : 0; } /* add a location to the table */ -- 2.17.1