Nikolay Sivov : ole32: Do not allocate spyed memory array on freeing attempts.

Alexandre Julliard julliard at winehq.org
Mon Apr 20 15:48:19 CDT 2020


Module: wine
Branch: master
Commit: ed53127580413b6d48c63e98e12ba7a801d64135
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ed53127580413b6d48c63e98e12ba7a801d64135

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Apr 20 10:59:18 2020 +0300

ole32: Do not allocate spyed memory array on freeing attempts.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ole32/ifs.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/dlls/ole32/ifs.c b/dlls/ole32/ifs.c
index 1b19be424c..dfced20de2 100644
--- a/dlls/ole32/ifs.c
+++ b/dlls/ole32/ifs.c
@@ -128,22 +128,19 @@ static void** mallocspy_is_allocation_spyed(const void *mem)
     return current;
 }
 
-static BOOL RemoveMemoryLocation(LPCVOID pMem)
+static BOOL mallocspy_remove_spyed_memory(const void *mem)
 {
-        LPVOID * Current;
+    void **current;
 
-	/* allocate the table if not already allocated */
-        if (!Malloc32.SpyedBlockTableLength && !SetSpyedBlockTableLength(0x1000))
-            return FALSE;
+    if (!Malloc32.SpyedBlockTableLength)
+        return FALSE;
 
-        if (!(Current = mallocspy_is_allocation_spyed(pMem)))
-            return FALSE;
+    if (!(current = mallocspy_is_allocation_spyed(mem)))
+        return FALSE;
 
-	/* location found */
-        Malloc32.SpyedAllocationsLeft--;
-	/*TRACE("%lu\n",Malloc32.SpyedAllocationsLeft);*/
-	*Current = NULL;
-        return TRUE;
+    Malloc32.SpyedAllocationsLeft--;
+    *current = NULL;
+    return TRUE;
 }
 
 /******************************************************************************
@@ -216,7 +213,7 @@ static void * WINAPI IMalloc_fnRealloc(IMalloc *iface, void *pv, SIZE_T cb)
 	    BOOL fSpyed;
 
 	    EnterCriticalSection(&IMalloc32_SpyCS);
-            fSpyed = RemoveMemoryLocation(pv);
+            fSpyed = mallocspy_remove_spyed_memory(pv);
             cb = IMallocSpy_PreRealloc(Malloc32.pSpy, pv, cb, &pRealMemory, fSpyed);
 
 	    /* check if can release the spy */
@@ -268,7 +265,7 @@ static void WINAPI IMalloc_fnFree(IMalloc *iface, void *pv)
 
 	if(Malloc32.pSpy) {
             EnterCriticalSection(&IMalloc32_SpyCS);
-            fSpyed = RemoveMemoryLocation(pv);
+            fSpyed = mallocspy_remove_spyed_memory(pv);
 	    pv = IMallocSpy_PreFree(Malloc32.pSpy, pv, fSpyed);
 	}
 




More information about the wine-cvs mailing list