diff options
author | Alexandra Khirnova <alexandra.khirnova@gmail.com> | 2013-12-06 13:44:17 +0100 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-12-09 12:27:51 +0200 |
commit | 9b8d11a76ae7bca8bbb58abb822138f8b42c776c (patch) | |
tree | 702aed7eb0e0684c7a91fdac06a9981fb4333c49 /libavcodec/libvpxenc.c | |
parent | d4f1188d1a662fed5347e70016da49e01563e8a8 (diff) | |
download | ffmpeg-9b8d11a76ae7bca8bbb58abb822138f8b42c776c.tar.gz |
avcodec: Use av_reallocp where suitable
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r-- | libavcodec/libvpxenc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index ce8ea33149..dc1ddc3dc9 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -468,11 +468,13 @@ static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out, break; case VPX_CODEC_STATS_PKT: { struct vpx_fixed_buf *stats = &ctx->twopass_stats; - stats->buf = av_realloc(stats->buf, - stats->sz + pkt->data.twopass_stats.sz); - if (!stats->buf) { + int err; + if ((err = av_reallocp(&stats->buf, + stats->sz + + pkt->data.twopass_stats.sz)) < 0) { + stats->sz = 0; av_log(avctx, AV_LOG_ERROR, "Stat buffer realloc failed\n"); - return AVERROR(ENOMEM); + return err; } memcpy((uint8_t*)stats->buf + stats->sz, pkt->data.twopass_stats.buf, pkt->data.twopass_stats.sz); |