From: Michael Niedermayer Date: Fri, 18 Jul 2008 11:38:53 +0000 (+0000) Subject: Only realloc() bitstream buffer when the needed size increased, X-Git-Tag: v0.5~3623 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cfcd396bae11de94ad4a729361bc9b7b05f04c27;p=platform%2Fupstream%2Flibav.git Only realloc() bitstream buffer when the needed size increased, this is needed to prevent loosing bitstream data with large metadata. Originally committed as revision 14279 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavcodec/flac.c b/libavcodec/flac.c index a7ba016..5745210 100644 --- a/libavcodec/flac.c +++ b/libavcodec/flac.c @@ -139,7 +139,8 @@ static void allocate_buffers(FLACContext *s){ s->decoded[i] = av_realloc(s->decoded[i], sizeof(int32_t)*s->max_blocksize); } - s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); + if(s->allocated_bitstream_size < s->max_framesize) + s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); } void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,