Commit 1e3bc9f3 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Improve thread safety in DidAlloc().

parent 08f4b6ee
......@@ -323,7 +323,7 @@ static SIZE_T WINAPI IMalloc_fnGetSize(IMalloc *iface, void *pv)
*/
static INT WINAPI IMalloc_fnDidAlloc(IMalloc *iface, void *mem)
{
BOOL spyed_block = FALSE;
BOOL spyed_block = FALSE, spy_active = FALSE;
int did_alloc;
TRACE("(%p)\n", mem);
......@@ -335,12 +335,13 @@ static INT WINAPI IMalloc_fnDidAlloc(IMalloc *iface, void *mem)
{
EnterCriticalSection(&IMalloc32_SpyCS);
spyed_block = !!mallocspy_is_allocation_spyed(mem);
spy_active = TRUE;
mem = IMallocSpy_PreDidAlloc(Malloc32.pSpy, mem, spyed_block);
}
did_alloc = HeapValidate(GetProcessHeap(), 0, mem);
if (Malloc32.pSpy)
if (spy_active)
{
did_alloc = IMallocSpy_PostDidAlloc(Malloc32.pSpy, mem, spyed_block, did_alloc);
LeaveCriticalSection(&IMalloc32_SpyCS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment