X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fansi.c;h=f1fafab771bef656c572b21543ac232bb95407bb;hb=fe9242204d33db070b8a9d907d93c9ead8a6f3ee;hp=3c82dcd338c38bca77dd34b8f5e61b1b41120d26;hpb=313264ba249421dcd0f7040fe3fb5101a61e88b3;p=ffmpeg diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c index 3c82dcd338c..f1fafab771b 100644 --- a/libavcodec/ansi.c +++ b/libavcodec/ansi.c @@ -80,10 +80,6 @@ static av_cold int decode_init(AVCodecContext *avctx) AnsiContext *s = avctx->priv_data; avctx->pix_fmt = AV_PIX_FMT_PAL8; - s->frame = av_frame_alloc(); - if (!s->frame) - return AVERROR(ENOMEM); - /* defaults */ s->font = avpriv_vga16_font; s->font_height = 16; @@ -98,6 +94,11 @@ static av_cold int decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %d %d\n", avctx->width, avctx->height); return AVERROR(EINVAL); } + + s->frame = av_frame_alloc(); + if (!s->frame) + return AVERROR(ENOMEM); + return 0; }