[PATCH] ole32: LeaveCriticalSection in one exit case (Coverity)

Marcus Meissner marcus at jet.franken.de
Tue Jun 25 02:59:34 CDT 2013


When the spy is being freed we would not release the critical
section out of this function.

 502283 Missing unlock

(The two if()s are not that well mergable, I don't know how
 to make this logically or codewise look better.
)

Ciao, Marcus
---
 dlls/ole32/ifs.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/ifs.c b/dlls/ole32/ifs.c
index 8ec6bd8..35ed04b 100644
--- a/dlls/ole32/ifs.c
+++ b/dlls/ole32/ifs.c
@@ -217,13 +217,16 @@ static LPVOID WINAPI IMalloc_fnRealloc(LPMALLOC iface,LPVOID pv,DWORD cb) {
 	        IMallocSpy_Release(Malloc32.pSpy);
 		Malloc32.SpyReleasePending = FALSE;
 		Malloc32.pSpy = NULL;
+		LeaveCriticalSection(&IMalloc32_SpyCS);
 	    }
 
 	    if (0==cb) {
-	        /* PreRealloc can force Realloc to fail */
-                LeaveCriticalSection(&IMalloc32_SpyCS);
+		/* PreRealloc can force Realloc to fail */
+		if (Malloc32.pSpy)
+		    LeaveCriticalSection(&IMalloc32_SpyCS);
 		return NULL;
 	    }
+
 	    pv = pRealMemory;
 	}
 
-- 
1.7.10.4




More information about the wine-patches mailing list