diff mbox series

[FFmpeg-devel,16/54] avformat/jacosubdec: Simplify cleanup after read_header failure

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

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/jacosubdec.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index c8bded02fe..510219224f 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -200,8 +200,7 @@  static int jacosub_read_header(AVFormatContext *s)
             sub = ff_subtitles_queue_insert(&jacosub->q, line, len, merge_line);
             if (!sub) {
                 av_bprint_finalize(&header, NULL);
-                ret = AVERROR(ENOMEM);
-                goto fail;
+                return AVERROR(ENOMEM);
             }
             sub->pos = pos;
             merge_line = len > 1 && !strcmp(&line[len - 2], "\\\n");
@@ -246,7 +245,7 @@  static int jacosub_read_header(AVFormatContext *s)
     /* general/essential directives in the extradata */
     ret = ff_bprint_to_codecpar_extradata(st->codecpar, &header);
     if (ret < 0)
-        goto fail;
+        return ret;
 
     /* SHIFT and TIMERES affect the whole script so packet timing can only be
      * done in a second pass */
@@ -257,9 +256,6 @@  static int jacosub_read_header(AVFormatContext *s)
     ff_subtitles_queue_finalize(s, &jacosub->q);
 
     return 0;
-fail:
-    jacosub_read_close(s);
-    return ret;
 }
 
 static int jacosub_read_packet(AVFormatContext *s, AVPacket *pkt)
@@ -280,6 +276,7 @@  const AVInputFormat ff_jacosub_demuxer = {
     .name           = "jacosub",
     .long_name      = NULL_IF_CONFIG_SMALL("JACOsub subtitle format"),
     .priv_data_size = sizeof(JACOsubContext),
+    .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = jacosub_probe,
     .read_header    = jacosub_read_header,
     .read_packet    = jacosub_read_packet,