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/motionpixels.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/motionpixels.c')
-rw-r--r-- | libavcodec/motionpixels.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 02ea04986a..dcdd5d2757 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -297,7 +297,9 @@ static int mp_decode_frame(AVCodecContext *avctx, } /* le32 bitstream msb first */ - mp->bswapbuf = av_fast_realloc(mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + if (!mp->bswapbuf) + AVERROR(ENOMEM); mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4); if (buf_size & 3) memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3); |