vlc | branch: master | Adrien Maglo <[email protected]> | Tue Mar  1 
17:40:48 2016 +0100| [69477405985aa366b68dfd86356ce69c43c3aeb6] | committer: 
Thomas Guillem

transcode: destroy the mutex and condition only if they have been initialized.

If i_threads == 0, both are not initialized as the function transcode_video_new
returns before the call to vlc_mutex_init and vlc_cond_init.

This patch fixes a deadlock on vlc_cond_destroy called with an uninitialized
condition variable argument.

Signed-off-by: Thomas Guillem <[email protected]>

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

 modules/stream_out/transcode/video.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/stream_out/transcode/video.c 
b/modules/stream_out/transcode/video.c
index 10ef868..adfea43 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -589,8 +589,11 @@ void transcode_video_close( sout_stream_t *p_stream,
         block_ChainRelease( p_stream->p_sys->p_buffers );
     }
 
-    vlc_mutex_destroy( &p_stream->p_sys->lock_out );
-    vlc_cond_destroy( &p_stream->p_sys->cond );
+    if( p_stream->p_sys->i_threads >= 1 )
+    {
+        vlc_mutex_destroy( &p_stream->p_sys->lock_out );
+        vlc_cond_destroy( &p_stream->p_sys->cond );
+    }
 
     /* Close decoder */
     if( id->p_decoder->p_module )

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to