[PATCH 1/2] winealsa.drv: Leave the CriticalSection before destroying it. Found by Smatch.

Michael Stefaniuc mstefani at redhat.de
Mon Oct 22 15:45:54 CDT 2007


MSDN says that if a CriticalSection is deleted while it is still hold
all the other threads waiting to aquire the lock will be in an undefined
state.

I checked other Wine code that aquires and destroies a lock in the same
function and all release the lock before destoying it.
---
 dlls/winealsa.drv/dscapture.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/dlls/winealsa.drv/dscapture.c b/dlls/winealsa.drv/dscapture.c
index 3e6984a..168fc91 100644
--- a/dlls/winealsa.drv/dscapture.c
+++ b/dlls/winealsa.drv/dscapture.c
@@ -534,6 +534,7 @@ static ULONG WINAPI IDsCaptureDriverBufferImpl_Release(PIDSCDRIVERBUFFER iface)
     TRACE("mmap buffer %p destroyed\n", This->mmap_buffer);
 
     This->drv->capture_buffer = NULL;
+    LeaveCriticalSection(&This->pcm_crst);
     This->pcm_crst.DebugInfo->Spare[0] = 0;
     DeleteCriticalSection(&This->pcm_crst);
 
-- 
1.5.3.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20071022/4fc8172f/attachment.pgp 


More information about the wine-patches mailing list