[vlc-devel] [PATCH 4/4] transcode: destroy the thread mutex and condition variable only if they have been initialized.
Adrien Maglo
magsoft at videolan.org
Tue Mar 1 17:40:48 CET 2016
If i_threads == 0, both are not initialized as the function transcode_video_new returns at line 216, 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.
---
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..f2749e5 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 )
--
2.5.0
More information about the vlc-devel
mailing list