]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/hcom: Cleanup generically upon init failure
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 14 Sep 2020 15:39:55 +0000 (17:39 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 15 Sep 2020 17:25:26 +0000 (19:25 +0200)
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/hcom.c

index 8300676f98a6519af81954e9fd2097a89dcadef5..06fa25fcd242c9f36c39675e9da6733f76e14205 100644 (file)
@@ -67,15 +67,11 @@ static av_cold int hcom_init(AVCodecContext *avctx)
         if (s->dict[i].l >= 0 &&
             (s->dict[i].l >= s->dict_entries ||
              s->dict[i].r >= s->dict_entries ||
-             s->dict[i].r < 0 )) {
-            av_freep(&s->dict);
+             s->dict[i].r < 0 ))
             return AVERROR_INVALIDDATA;
-        }
     }
-    if (s->dict[0].l < 0) {
-        av_freep(&s->dict);
+    if (s->dict[0].l < 0)
         return AVERROR_INVALIDDATA;
-    }
 
     avctx->sample_fmt = AV_SAMPLE_FMT_U8;
     s->dict_entry = 0;
@@ -148,4 +144,5 @@ AVCodec ff_hcom_decoder = {
     .close          = hcom_close,
     .decode         = hcom_decode,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };