diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-04-12 13:17:37 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-04-12 13:17:37 +0000 |
commit | 238ef6dadd13b9a867eaa7382bdba751e25c40b9 (patch) | |
tree | ac0228289581351403ee3f1d9ad187919d498fbb /libavcodec/h263dec.c | |
parent | 9bf993a5b5f8bf10c590d83c795467606f92cf6e (diff) | |
download | ffmpeg-238ef6dadd13b9a867eaa7382bdba751e25c40b9.tar.gz |
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
Diffstat (limited to 'libavcodec/h263dec.c')
-rw-r--r-- | libavcodec/h263dec.c | 6 |
1 files changed, 4 insertions, 2 deletions
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; } |