ole32: Cope with a realloc returning a different pointer.

This commit is contained in:
Huw Davies 2007-05-02 16:48:22 +01:00 committed by Alexandre Julliard
parent 2d50aa3644
commit 962d8b6011
1 changed files with 4 additions and 2 deletions

View File

@ -56,7 +56,7 @@ typedef struct {
DWORD SpyedAllocationsLeft; /* number of spyed allocations left */
BOOL SpyReleasePending; /* CoRevokeMallocSpy called with spyed allocations left*/
LPVOID * SpyedBlocks; /* root of the table */
int SpyedBlockTableLength; /* size of the table*/
DWORD SpyedBlockTableLength;/* size of the table*/
} _Malloc32;
/* this is the static object instance */
@ -73,7 +73,7 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
static CRITICAL_SECTION IMalloc32_SpyCS = { &critsect_debug, -1, 0, 0, 0, 0 };
/* resize the old table */
static int SetSpyedBlockTableLength ( int NewLength )
static int SetSpyedBlockTableLength ( DWORD NewLength )
{
LPVOID *NewSpyedBlocks;
@ -103,7 +103,9 @@ static int AddMemoryLocation(LPVOID * pMem)
Current++;
if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) {
/* no more space in table, grow it */
DWORD old_length = Malloc32.SpyedBlockTableLength;
if (!SetSpyedBlockTableLength( Malloc32.SpyedBlockTableLength + 0x1000 )) return 0;
Current = Malloc32.SpyedBlocks + old_length;
}
};