[vlc-commits] transcode: fix object leak with audio transcoding.
Jean-Paul Saman
git at videolan.org
Mon Jan 20 17:23:07 CET 2014
vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Mon Jan 20 15:51:08 2014 +0100| [184e5a3fedb0a3f08d0ffa9ab30af8d52f3f277a] | committer: Jean-Paul Saman
transcode: fix object leak with audio transcoding.
Transcoding audio could result in an assert being triggered on an objects refcount at
exit of vlc. The issue was introduced by commit id: 651ed87f2bc8f2299c823122406e524b30590d2f
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=184e5a3fedb0a3f08d0ffa9ab30af8d52f3f277a
---
modules/stream_out/transcode/audio.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index 46872c5..26d25cd 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -346,14 +346,22 @@ bool transcode_audio_add( sout_stream_t *p_stream, es_format_t *p_fmt,
return false;
}
- module_unneed( id->p_encoder, id->p_encoder->p_module );
- if( id->p_encoder->fmt_out.p_extra )
+ /* Reinit encoder again later on, when all information from decoders
+ * is available. */
+ if( id->p_encoder->p_module )
{
- free( id->p_encoder->fmt_out.p_extra );
- id->p_encoder->fmt_out.p_extra = NULL;
- id->p_encoder->fmt_out.i_extra = 0;
+ module_unneed( id->p_encoder, id->p_encoder->p_module );
+ id->p_encoder->p_module = NULL;
+ if( id->p_encoder->fmt_out.p_extra )
+ {
+ free( id->p_encoder->fmt_out.p_extra );
+ id->p_encoder->fmt_out.p_extra = NULL;
+ id->p_encoder->fmt_out.i_extra = 0;
+ }
+ if( id->p_af_chain != NULL )
+ aout_FiltersDelete( (vlc_object_t *)NULL, id->p_af_chain );
+ id->p_af_chain = NULL;
}
- id->p_encoder->p_module = NULL;
date_Init( &id->interpolated_pts, p_fmt->audio.i_rate, 1 );
More information about the vlc-commits
mailing list