1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-07-11 14:30:22 +02:00

avcodec: Use av_reallocp where suitable

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Alexandra Khirnova
2013-12-06 13:44:17 +01:00
committed by Martin Storsjö
parent d4f1188d1a
commit 9b8d11a76a
10 changed files with 73 additions and 76 deletions

View File

@ -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);