From 9b8d11a76ae7bca8bbb58abb822138f8b42c776c Mon Sep 17 00:00:00 2001 From: Alexandra Khirnova Date: Fri, 6 Dec 2013 13:44:17 +0100 Subject: avcodec: Use av_reallocp where suitable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libvpxenc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libavcodec/libvpxenc.c') 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); -- cgit v1.2.3