Merge commit '7244cefd6e6ba7258cb022dfd7a284099d88a3e8' into release/2.4
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 19 May 2015 18:14:16 +0000 (20:14 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 19 May 2015 18:15:15 +0000 (20:15 +0200)
* commit '7244cefd6e6ba7258cb022dfd7a284099d88a3e8':
  libvpx: Fix mixed use of av_malloc() and av_reallocp()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/libvpxenc.c

@@@ -384,12 -299,12 +384,12 @@@ static av_cold int vpx_init(AVCodecCont
          }
  
          ctx->twopass_stats.sz  = strlen(avctx->stats_in) * 3 / 4;
-         ctx->twopass_stats.buf = av_malloc(ctx->twopass_stats.sz);
-         if (!ctx->twopass_stats.buf) {
+         ret = av_reallocp(&ctx->twopass_stats.buf, ctx->twopass_stats.sz);
+         if (ret < 0) {
              av_log(avctx, AV_LOG_ERROR,
 -                   "Stat buffer alloc (%zu bytes) failed\n",
 +                   "Stat buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n",
                     ctx->twopass_stats.sz);
-             return AVERROR(ENOMEM);
+             return ret;
          }
          decode_size = av_base64_decode(ctx->twopass_stats.buf, avctx->stats_in,
                                         ctx->twopass_stats.sz);