From 56b31a8ee2fa07d2a26e4fe2976157da6c1af637 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Mon, 28 Feb 2005 05:27:21 +0000 Subject: [PATCH] 10l (deallocated memory again) Originally committed as revision 3994 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/flac.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavcodec/flac.c b/libavcodec/flac.c index de1c5255ce..894da93848 100644 --- a/libavcodec/flac.c +++ b/libavcodec/flac.c @@ -637,10 +637,17 @@ static int flac_decode_frame(AVCodecContext *avctx, switch(metadata_type) { case METADATA_TYPE_STREAMINFO:{ - int bits_count= get_bits_count(&s->gb); - metadata_streaminfo(s); + /* Buffer might have been reallocated, reinit bitreader */ + if(buf != &s->bitstream[s->bitstream_index]) + { + int bits_count = get_bits_count(&s->gb); + buf= &s->bitstream[s->bitstream_index]; + init_get_bits(&s->gb, buf, buf_size*8); + skip_bits(&s->gb, bits_count); + } + dump_headers(s); break;} default: