Fixes: Null pointer dereference Fixes: any mpeg4 testcase which fails the malloc at that exact spot
Unified · Split
| @@ -1304,6 +1304,8 @@ static av_cold int encode_init(AVCodecContext *avctx) · 1303 unmodified lines | ||
| 1304 | 1304 | |
| 1305 | 1305 | if (s->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { |
| 1306 | 1306 | s->avctx->extradata = av_malloc(1024); |
| 1307 | + if (!s->avctx->extradata) | |
| 1308 | + return AVERROR(ENOMEM); | |
| 1307 | 1309 | init_put_bits(&s->pb, s->avctx->extradata, 1024); |
| 1308 | 1310 | |
| 1309 | 1311 | if (!(s->workaround_bugs & FF_BUG_MS)) |