ole32: Hold a lock when checking is spy is already registered.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-03-04 11:24:32 +03:00 committed by Alexandre Julliard
parent cef4c7dc69
commit 7c0b1b6268
1 changed files with 3 additions and 2 deletions

View File

@ -467,11 +467,12 @@ HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
TRACE("%p\n", pMallocSpy);
if(!pMallocSpy) return E_INVALIDARG;
if(Malloc32.pSpy) return CO_E_OBJISREG;
EnterCriticalSection(&IMalloc32_SpyCS);
if (SUCCEEDED(IMallocSpy_QueryInterface(pMallocSpy, &IID_IMallocSpy, (void**)&pSpy))) {
if (Malloc32.pSpy)
hres = CO_E_OBJISREG;
else if (SUCCEEDED(IMallocSpy_QueryInterface(pMallocSpy, &IID_IMallocSpy, (void**)&pSpy))) {
Malloc32.pSpy = pSpy;
hres = S_OK;
}