Huw Davies : ole32: Cope with a realloc returning a different pointer.

Alexandre Julliard julliard at wine.codeweavers.com
Thu May 3 08:57:07 CDT 2007


Module: wine
Branch: master
Commit: 962d8b60113a4b66ce81202645178928c9f0bd8b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=962d8b60113a4b66ce81202645178928c9f0bd8b

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed May  2 16:48:22 2007 +0100

ole32: Cope with a realloc returning a different pointer.

---

 dlls/ole32/ifs.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/ifs.c b/dlls/ole32/ifs.c
index 37ef44e..bd8f483 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;
 	    }
 	};
 




More information about the wine-cvs mailing list