diff mbox series

[FFmpeg-devel,22/54] avformat/mccdec: Simplify cleanup after read_header failure

Message ID HE1PR0301MB21541F44B4A064F9BCCBB6508F309@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit d18eee412abeb8151079a3c204483a181cacc0d9
Headers show
Series [FFmpeg-devel,01/54] avformat: Add internal flags for AV(In|Out)putFormat
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt June 15, 2021, 11:32 p.m. UTC
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/mccdec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/mccdec.c b/libavformat/mccdec.c
index a096ac6e93..d206fc2d62 100644
--- a/libavformat/mccdec.c
+++ b/libavformat/mccdec.c
@@ -189,7 +189,7 @@  static int mcc_read_header(AVFormatContext *s)
             continue;
         sub = ff_subtitles_queue_insert(&mcc->q, out + start, count, 0);
         if (!sub)
-            goto fail;
+            return AVERROR(ENOMEM);
 
         sub->pos = pos;
         sub->pts = ts;
@@ -199,9 +199,6 @@  static int mcc_read_header(AVFormatContext *s)
     ff_subtitles_queue_finalize(s, &mcc->q);
 
     return ret;
-fail:
-    ff_subtitles_queue_clean(&mcc->q);
-    return AVERROR(ENOMEM);
 }
 
 static int mcc_read_packet(AVFormatContext *s, AVPacket *pkt)
@@ -229,6 +226,7 @@  const AVInputFormat ff_mcc_demuxer = {
     .name           = "mcc",
     .long_name      = NULL_IF_CONFIG_SMALL("MacCaption"),
     .priv_data_size = sizeof(MCCContext),
+    .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = mcc_probe,
     .read_header    = mcc_read_header,
     .read_packet    = mcc_read_packet,