Make sure the 'alsa handle' is initialized to NULL before calling
snd_pcm_open(). Otherwise if it fails we get a crash trying to close
an invalid alsa handle.
diff --git a/dlls/winmm/winealsa/audio.c b/dlls/winmm/winealsa/audio.c
index af81e87..48bc7ad 100644
--- a/dlls/winmm/winealsa/audio.c
+++ b/dlls/winmm/winealsa/audio.c
@@ -522,7 +522,7 @@
*/
LONG ALSA_WaveInit(void)
{
- snd_pcm_t* h = NULL;
+ snd_pcm_t* h;
snd_pcm_info_t * info;
snd_pcm_hw_params_t * hw_params;
WINE_WAVEOUT* wwo;
@@ -555,6 +555,7 @@
#define EXIT_ON_ERROR(f,txt) do { int err; if ( (err = (f) ) < 0) { ERR(txt ": %s\n", snd_strerror(err)); if (h) snd_pcm_close(h); return -1; } } while(0)
+ h = NULL;
ALSA_WodNumDevs = 0;
EXIT_ON_ERROR( snd_pcm_open(&h, wwo->device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK) , "open pcm" );
if (!h) return -1;
@@ -661,6 +662,7 @@
#define EXIT_ON_ERROR(f,txt) do { int err; if ( (err = (f) ) < 0) { ERR(txt ": %s\n", snd_strerror(err)); if (h) snd_pcm_close(h); return -1; } } while(0)
+ h = NULL;
ALSA_WidNumDevs = 0;
EXIT_ON_ERROR( snd_pcm_open(&h, wwi->device, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK) , "open pcm" );
if (!h) return -1;