ffv1enc: check for malloc failure
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 16 Aug 2013 23:38:32 +0000 (01:38 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 16 Aug 2013 23:43:30 +0000 (01:43 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/ffv1enc.c

index 23fb23b..bb7e087 100644 (file)
@@ -529,6 +529,8 @@ static int write_extradata(FFV1Context *f)
     f->avctx->extradata_size = 10000 + 4 +
                                     (11 * 11 * 5 * 5 * 5 + 11 * 11 * 11) * 32;
     f->avctx->extradata = av_malloc(f->avctx->extradata_size);
+    if (!f->avctx->extradata)
+        return AVERROR(ENOMEM);
     ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size);
     ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);