From 962d8b60113a4b66ce81202645178928c9f0bd8b Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Wed, 2 May 2007 16:48:22 +0100 Subject: [PATCH] ole32: Cope with a realloc returning a different pointer. --- dlls/ole32/ifs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/ole32/ifs.c b/dlls/ole32/ifs.c index 37ef44e2873..bd8f483bd4f 100644 --- a/dlls/ole32/ifs.c +++ b/dlls/ole32/ifs.c @@ -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; } };