Merge commit '7244cefd6e6ba7258cb022dfd7a284099d88a3e8' into release/2.4

* commit '7244cefd6e6ba7258cb022dfd7a284099d88a3e8':
  libvpx: Fix mixed use of av_malloc() and av_reallocp()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-05-19 20:14:16 +02:00
commit d61022d55f
1 changed files with 4 additions and 4 deletions

View File

@ -376,7 +376,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
if (enccfg.g_pass == VPX_RC_FIRST_PASS) if (enccfg.g_pass == VPX_RC_FIRST_PASS)
enccfg.g_lag_in_frames = 0; enccfg.g_lag_in_frames = 0;
else if (enccfg.g_pass == VPX_RC_LAST_PASS) { else if (enccfg.g_pass == VPX_RC_LAST_PASS) {
int decode_size; int decode_size, ret;
if (!avctx->stats_in) { if (!avctx->stats_in) {
av_log(avctx, AV_LOG_ERROR, "No stats file for second pass\n"); av_log(avctx, AV_LOG_ERROR, "No stats file for second pass\n");
@ -384,12 +384,12 @@ static av_cold int vpx_init(AVCodecContext *avctx,
} }
ctx->twopass_stats.sz = strlen(avctx->stats_in) * 3 / 4; ctx->twopass_stats.sz = strlen(avctx->stats_in) * 3 / 4;
ctx->twopass_stats.buf = av_malloc(ctx->twopass_stats.sz); ret = av_reallocp(&ctx->twopass_stats.buf, ctx->twopass_stats.sz);
if (!ctx->twopass_stats.buf) { if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
"Stat buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n", "Stat buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n",
ctx->twopass_stats.sz); ctx->twopass_stats.sz);
return AVERROR(ENOMEM); return ret;
} }
decode_size = av_base64_decode(ctx->twopass_stats.buf, avctx->stats_in, decode_size = av_base64_decode(ctx->twopass_stats.buf, avctx->stats_in,
ctx->twopass_stats.sz); ctx->twopass_stats.sz);