From 238ef6dadd13b9a867eaa7382bdba751e25c40b9 Mon Sep 17 00:00:00 2001 From: Reimar Döffinger Date: Sun, 12 Apr 2009 13:17:37 +0000 Subject: Add a av_fast_malloc function and replace several uses of av_fast_realloc, thus avoiding potential memleaks and pointless memcpys. Originally committed as revision 18470 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/h263dec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libavcodec/h263dec.c') diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 2f57573394..fa8fd1f9ab 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -687,10 +687,12 @@ retry: } if(startcode_found){ - s->bitstream_buffer= av_fast_realloc( - s->bitstream_buffer, + av_fast_malloc( + &s->bitstream_buffer, &s->allocated_bitstream_buffer_size, buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE); + if (!s->bitstream_buffer) + return AVERROR(ENOMEM); memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); s->bitstream_buffer_size= buf_size - current_pos; } -- cgit v1.2.3