Swap arguments of LocalAlloc and only update Malloc32 block on
successful allocation.
This commit is contained in:
parent
8d96cd311b
commit
1d0598b0aa
|
@ -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);
|
||||
LPVOID *NewSpyedBlocks;
|
||||
|
||||
if (!Malloc32.SpyedBlocks) NewSpyedBlocks = LocalAlloc(GMEM_ZEROINIT, NewLength);
|
||||
else NewSpyedBlocks = LocalReAlloc(Malloc32.SpyedBlocks, NewLength, GMEM_ZEROINIT);
|
||||
if (NewSpyedBlocks) {
|
||||
Malloc32.SpyedBlocks = NewSpyedBlocks;
|
||||
Malloc32.SpyedBlockTableLength = NewLength;
|
||||
return Malloc32.SpyedBlocks ? 1 : 0;
|
||||
}
|
||||
|
||||
return NewSpyedBlocks != NULL;
|
||||
}
|
||||
|
||||
/* add a location to the table */
|
||||
|
|
Loading…
Reference in New Issue