[PATCH 3/3] ole32: Hold a lock when checking is spy is already registered

Nikolay Sivov nsivov at codeweavers.com
Fri Mar 4 02:24:32 CST 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/ole32/ifs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/ifs.c b/dlls/ole32/ifs.c
index 7469fb2..c9e5625 100644
--- a/dlls/ole32/ifs.c
+++ b/dlls/ole32/ifs.c
@@ -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;
 	}
-- 
2.7.0




More information about the wine-patches mailing list