[vlc-commits] avcodec: fix memory leaks if audio output fails
Rémi Denis-Courmont
git at videolan.org
Fri Jul 26 21:24:05 CEST 2013
vlc/vlc-2.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jul 26 22:22:59 2013 +0300| [f93d1607cd8f782be2533f6b59cad9f48f6c6831] | committer: Rémi Denis-Courmont
avcodec: fix memory leaks if audio output fails
Bug originally fixed in 2cc8adc05519e03fb78f9ac94d3193c1ad94c712.
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=f93d1607cd8f782be2533f6b59cad9f48f6c6831
---
modules/codec/avcodec/audio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index d6c0313..c223ede 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -332,7 +332,13 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
block_t *p_buffer = decoder_NewAudioBuffer( p_dec, p_block->i_nb_samples );
if (!p_buffer)
+ {
+ block_Release( p_block );
+ if( av_sample_fmt_is_planar( ctx->sample_fmt )
+ && ctx->channels > AV_NUM_DATA_POINTERS )
+ free( frame.extended_data );
return NULL;
+ }
assert( p_block->i_nb_samples >= (unsigned)frame.nb_samples );
assert( p_block->i_nb_samples == p_buffer->i_nb_samples );
p_block->i_buffer = p_buffer->i_buffer; /* drop buffer padding */
More information about the vlc-commits
mailing list