aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-09 21:15:50 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-09 21:18:36 +0100
commita11440c1857babc2c1184b83c19b9e66c9a6fe95 (patch)
treeb9ee0581b00d7f1fecd35f45076ee7deccc4fae9
parente71dce5769b2282824da7cfd6f7e4ce0d1985876 (diff)
parent93f7948136fcda8ddbbc44a6c24418f11ca829b8 (diff)
downloadffmpeg-a11440c1857babc2c1184b83c19b9e66c9a6fe95.tar.gz
Merge commit '93f7948136fcda8ddbbc44a6c24418f11ca829b8'
* commit '93f7948136fcda8ddbbc44a6c24418f11ca829b8': libvpx: Fix mixed use of av_malloc() and av_reallocp() Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/libvpxenc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 69c3a459d6..3def947f05 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -377,7 +377,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");
@@ -385,12 +385,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 (%"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);