X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fhuffyuvenc.c;h=22e2cb86e3d1cba539b569b3778b5a158663a2e8;hb=abee1972ef8a88fde0bff5f40f4767cb3150d26e;hp=f0179dfa5beb9b8a1f2b52d3eb17f66fb56d21b8;hpb=ae99f06e5a5f8010a0050bbb05636515d92064f9;p=ffmpeg diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index f0179dfa5be..22e2cb86e3d 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -220,8 +220,6 @@ static av_cold int encode_init(AVCodecContext *avctx) ff_huffyuvencdsp_init(&s->hencdsp); avctx->extradata = av_mallocz(3*MAX_N + 4); - if (!avctx->extradata) - return AVERROR(ENOMEM); if (s->flags&CODEC_FLAG_PASS1) { #define STATS_OUT_SIZE 21*MAX_N*3 + 4 avctx->stats_out = av_mallocz(STATS_OUT_SIZE); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132 @@ -231,7 +229,7 @@ static av_cold int encode_init(AVCodecContext *avctx) s->version = 2; avctx->coded_frame = av_frame_alloc(); - if (!avctx->coded_frame) + if (!avctx->extradata || !avctx->coded_frame) return AVERROR(ENOMEM); avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;