From 04e3bda4104d7151cf0c1e676e7ffe39c3430f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Sun, 6 Mar 2011 23:03:52 +0100 Subject: [PATCH] winealsa: Open must fail when recorder thread creation fails. --- dlls/winealsa.drv/wavein.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/winealsa.drv/wavein.c b/dlls/winealsa.drv/wavein.c index daf73bede94..f92f18d2f1d 100644 --- a/dlls/winealsa.drv/wavein.c +++ b/dlls/winealsa.drv/wavein.c @@ -511,8 +511,13 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) wwi->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL); wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD_PTR)wDevID, 0, &(wwi->dwThreadID)); - if (wwi->hThread) - SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL); + if (!wwi->hThread) { + ERR("Thread creation for the widRecorder failed!\n"); + CloseHandle(wwi->hStartUpEvent); + ret = MMSYSERR_NOMEM; + goto error; + } + SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL); WaitForSingleObject(wwi->hStartUpEvent, INFINITE); CloseHandle(wwi->hStartUpEvent); wwi->hStartUpEvent = NULL; @@ -525,6 +530,8 @@ error: snd_pcm_close(pcm); HeapFree( GetProcessHeap(), 0, hw_params ); HeapFree( GetProcessHeap(), 0, sw_params ); + if (wwi->msgRing.ring_buffer_size > 0) + ALSA_DestroyRingMessage(&wwi->msgRing); return ret; }