[vlc-commits] access/alsa.c: fix racecondition on demux->p_sys variable

Jean-Paul Saman git at videolan.org
Wed Dec 11 15:58:09 CET 2013


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Dec 11 15:54:36 2013 +0100| [4a1493db19bb1db6a57b49bed385764a7d41793e] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a1493db19bb1db6a57b49bed385764a7d41793e
---

 modules/access/alsa.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/access/alsa.c b/modules/access/alsa.c
index d82ae18..1125545 100644
--- a/modules/access/alsa.c
+++ b/modules/access/alsa.c
@@ -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;



More information about the vlc-commits mailing list