[vlc-commits] transcode/video.c: Do not leak mutex/ conditional or fifo in transcode_video_new().

Jean-Paul Saman git at videolan.org
Wed Apr 17 12:07:55 CEST 2013


vlc | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Wed Apr 17 11:52:26 2013 +0200| [316c4550e7e07cf5a10a3afc98b283f5deaaa03a] | committer: Jean-Paul Saman

transcode/video.c: Do not leak mutex/conditional or fifo in transcode_video_new().

Do not leak mutex/conditional or fifo in transcode_video_new() its
error path when p_sys->i_thread > 1.

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

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

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index fc1a962..a0133ee 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -234,6 +234,8 @@ int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_t *id )
         if( p_sys->pp_pics == NULL )
         {
             msg_Err( p_stream, "cannot create picture fifo" );
+            vlc_mutex_destroy( &p_sys->lock_out );
+            vlc_cond_destroy( &p_sys->cond );
             module_unneed( id->p_decoder, id->p_decoder->p_module );
             id->p_decoder->p_module = NULL;
             free( id->p_decoder->p_owner );
@@ -244,6 +246,9 @@ int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_t *id )
         if( vlc_clone( &p_sys->thread, EncoderThread, p_sys, i_priority ) )
         {
             msg_Err( p_stream, "cannot spawn encoder thread" );
+            vlc_mutex_destroy( &p_sys->lock_out );
+            vlc_cond_destroy( &p_sys->cond );
+            picture_fifo_Delete( p_sys->pp_pics );
             module_unneed( id->p_decoder, id->p_decoder->p_module );
             id->p_decoder->p_module = NULL;
             free( id->p_decoder->p_owner );



More information about the vlc-commits mailing list