Fix crash in ALSA_WaveInit()
Francois Gouget
fgouget at codeweavers.com
Sun Apr 25 17:00:57 CDT 2004
Changelog:
* dlls/winmm/winealsa/audio.c
Francois Gouget <fgouget at codeweavers.com>
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.
--
Francois Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: dlls/winmm/winealsa/audio.c
===================================================================
RCS file: /var/cvs/wine/dlls/winmm/winealsa/audio.c,v
retrieving revision 1.36
diff -u -r1.36 audio.c
--- a/dlls/winmm/winealsa/audio.c 19 Apr 2004 23:06:48 -0000 1.36
+++ b/dlls/winmm/winealsa/audio.c 25 Apr 2004 21:58:29 -0000
@@ -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;
More information about the wine-patches
mailing list