[vlc-devel] [PATCH] audiotrack: fix benign race

Thomas Guillem thomas at gllm.fr
Thu Mar 5 17:38:18 CET 2015


---
 modules/audio_output/audiotrack.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index 7ac723a..09f7588 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -1221,6 +1221,7 @@ Open( vlc_object_t *obj )
 
     aout_SoftVolumeInit( p_aout );
 
+    vlc_mutex_lock( &p_sys->mutex );
     /* create JNIThread */
     p_sys->b_thread_run = true;
     if( vlc_clone( &p_sys->thread,
@@ -1228,9 +1229,11 @@ Open( vlc_object_t *obj )
     {
         msg_Err( p_aout, "JNIThread creation failed" );
         p_sys->b_thread_run = false;
+        vlc_mutex_unlock( &p_sys->mutex );
         Close( obj );
         return VLC_EGENERIC;
     }
+    vlc_mutex_unlock( &p_sys->mutex );
 
     return VLC_SUCCESS;
 }
-- 
2.1.3




More information about the vlc-devel mailing list