aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-01 11:55:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-01 11:59:02 +0200
commit3c536bee54cad7e5686f0383d1dce7cf18bd4db4 (patch)
tree139a8a0c52a8dfefe5b42cfef37b1c9aa0f7802f /libavcodec
parent4a620243b9618a75d3edbb436e102e944b55cede (diff)
parent891ed1184e49bc7944311302d9ece01e87c188a8 (diff)
downloadffmpeg-3c536bee54cad7e5686f0383d1dce7cf18bd4db4.tar.gz
Merge commit '891ed1184e49bc7944311302d9ece01e87c188a8' into release/2.2
* commit '891ed1184e49bc7944311302d9ece01e87c188a8': libvpx: Fix mixed use of av_malloc() and av_reallocp() Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libvpxenc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 869c8fe115..3dce6e0410 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -362,7 +362,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
if (enccfg.g_pass == VPX_RC_FIRST_PASS)
enccfg.g_lag_in_frames = 0;
else if (enccfg.g_pass == VPX_RC_LAST_PASS) {
- int decode_size;
+ int decode_size, ret;
if (!avctx->stats_in) {
av_log(avctx, AV_LOG_ERROR, "No stats file for second pass\n");
@@ -370,12 +370,12 @@ static av_cold int vpx_init(AVCodecContext *avctx,
}
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",
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);