avcodec/truemotion1: Cleanup generically after init failure
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 29 Aug 2020 07:39:40 +0000 (09:39 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 30 Aug 2020 01:07:33 +0000 (03:07 +0200)
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/truemotion1.c

index b6481cb..94782fe 100644 (file)
@@ -491,10 +491,8 @@ static av_cold int truemotion1_decode_init(AVCodecContext *avctx)
     /* there is a vertical predictor for each pixel in a line; each vertical
      * predictor is 0 to start with */
     av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int));
     /* there is a vertical predictor for each pixel in a line; each vertical
      * predictor is 0 to start with */
     av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int));
-    if (!s->vert_pred) {
-        av_frame_free(&s->frame);
+    if (!s->vert_pred)
         return AVERROR(ENOMEM);
         return AVERROR(ENOMEM);
-    }
 
     return 0;
 }
 
     return 0;
 }
@@ -922,4 +920,5 @@ AVCodec ff_truemotion1_decoder = {
     .close          = truemotion1_decode_end,
     .decode         = truemotion1_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
     .close          = truemotion1_decode_end,
     .decode         = truemotion1_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
 };