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

Alexandre Julliard julliard at wine.codeweavers.com
Fri Mar 4 09:48:34 CST 2016


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Mar  4 11:24:32 2016 +0300

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

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

---

 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;
 	}




More information about the wine-cvs mailing list