diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-09 20:31:29 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-09 20:31:29 +0100 |
commit | 8c677a9f06c5d145da0301cdc3c6bff9ebacb5d7 (patch) | |
tree | 9c756ade47cc06771cb120f53b5f9c22724717f6 /libavcodec/flashsv.c | |
parent | 94a849b8b6c3e4a90361485b2e12a9a5c35833a3 (diff) | |
parent | 9b8d11a76ae7bca8bbb58abb822138f8b42c776c (diff) | |
download | ffmpeg-8c677a9f06c5d145da0301cdc3c6bff9ebacb5d7.tar.gz |
Merge commit '9b8d11a76ae7bca8bbb58abb822138f8b42c776c'
* commit '9b8d11a76ae7bca8bbb58abb822138f8b42c776c':
avcodec: Use av_reallocp where suitable
Conflicts:
libavcodec/bitstream.c
libavcodec/eatgv.c
libavcodec/flashsv.c
libavcodec/libtheoraenc.c
libavcodec/libvpxenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/flashsv.c')
-rw-r--r-- | libavcodec/flashsv.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 6af7d9bbbe..981d774407 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -307,13 +307,13 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, /* the block size could change between frames, make sure the buffer * is large enough, if not, get a larger one */ if (s->block_size < s->block_width * s->block_height) { - int tmpblock_size = 3 * s->block_width * s->block_height; + int tmpblock_size = 3 * s->block_width * s->block_height, err; - s->tmpblock = av_realloc(s->tmpblock, tmpblock_size); - if (!s->tmpblock) { + if ((err = av_reallocp(&s->tmpblock, tmpblock_size)) < 0) { + s->block_size = 0; av_log(avctx, AV_LOG_ERROR, "Cannot allocate decompression buffer.\n"); - return AVERROR(ENOMEM); + return err; } if (s->ver == 2) { s->deflate_block_size = calc_deflate_block_size(tmpblock_size); @@ -322,12 +322,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, "Cannot determine deflate buffer size.\n"); return -1; } - s->deflate_block = av_realloc(s->deflate_block, - s->deflate_block_size); - if (!s->deflate_block) { - av_log(avctx, AV_LOG_ERROR, - "Cannot allocate deflate buffer.\n"); - return AVERROR(ENOMEM); + if ((err = av_reallocp(&s->deflate_block, s->deflate_block_size)) < 0) { + s->block_size = 0; + av_log(avctx, AV_LOG_ERROR, "Cannot allocate deflate buffer.\n"); + return err; } } } @@ -351,7 +349,9 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, /* we care for keyframes only in Screen Video v2 */ s->is_keyframe = (avpkt->flags & AV_PKT_FLAG_KEY) && (s->ver == 2); if (s->is_keyframe) { - s->keyframedata = av_realloc(s->keyframedata, avpkt->size); + int err; + if ((err = av_reallocp(&s->keyframedata, avpkt->size)) < 0) + return err; memcpy(s->keyframedata, avpkt->data, avpkt->size); } if(s->ver == 2 && !s->blocks) |