]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/roqvideodec: Cleanup generically after init failure
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 29 Aug 2020 07:04:42 +0000 (09:04 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 30 Aug 2020 01:00:13 +0000 (03:00 +0200)
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/roqvideodec.c

index a0c293f2f0430d791e02f54a1d635c87a443b318..dd045ed5ebd66c322688b7dfa910fbb9045dd5c2 100644 (file)
@@ -184,11 +184,8 @@ static av_cold int roq_decode_init(AVCodecContext *avctx)
 
     s->last_frame    = av_frame_alloc();
     s->current_frame = av_frame_alloc();
-    if (!s->current_frame || !s->last_frame) {
-        av_frame_free(&s->current_frame);
-        av_frame_free(&s->last_frame);
+    if (!s->current_frame || !s->last_frame)
         return AVERROR(ENOMEM);
-    }
 
     avctx->pix_fmt = AV_PIX_FMT_YUVJ444P;
     avctx->color_range = AVCOL_RANGE_JPEG;
@@ -248,4 +245,5 @@ AVCodec ff_roq_decoder = {
     .close          = roq_decode_end,
     .decode         = roq_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };