Commit 4a1493db authored by Jean-Paul Saman's avatar Jean-Paul Saman

access/alsa.c: fix racecondition on demux->p_sys variable

The Thread() function could access demux->p_sys before it was assigned a value other then NULL.
If this happens then it will crash on line 158 while accessing sys->pcm.
parent df8f47f6
......@@ -480,6 +480,7 @@ static int Open (vlc_object_t *obj)
/* Kick recording */
aout_FormatPrepare (&fmt.audio);
sys->es = es_out_Add (demux->out, &fmt);
demux->p_sys = sys;
if (vlc_clone (&sys->thread, Thread, demux, VLC_THREAD_PRIORITY_INPUT))
{
......@@ -487,7 +488,6 @@ static int Open (vlc_object_t *obj)
goto error;
}
demux->p_sys = sys;
demux->pf_demux = NULL;
demux->pf_control = Control;
return VLC_SUCCESS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment