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

Rémi Denis-Courmont remi at remlab.net
Thu Mar 5 17:45:38 CET 2015


Le 2015-03-05 19:38, Thomas Guillem a écrit :
> ---
>  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;
>  }

If the thread is not created, then there is no thread to race against.
If the thread is created, I don't see what the race is about.

-- 
Rémi Denis-Courmont



More information about the vlc-devel mailing list