Commit 0de329e8 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/aqtitledec: Simplify cleanup after read_header failure

by setting the FF_FMT_INIT_CLEANUP flag.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
parent 58da6b18
...@@ -81,11 +81,11 @@ static int aqt_read_header(AVFormatContext *s) ...@@ -81,11 +81,11 @@ static int aqt_read_header(AVFormatContext *s)
if (!new_event) { if (!new_event) {
sub = ff_subtitles_queue_insert(&aqt->q, "\n", 1, 1); sub = ff_subtitles_queue_insert(&aqt->q, "\n", 1, 1);
if (!sub) if (!sub)
goto fail; return AVERROR(ENOMEM);
} }
sub = ff_subtitles_queue_insert(&aqt->q, line, strlen(line), !new_event); sub = ff_subtitles_queue_insert(&aqt->q, line, strlen(line), !new_event);
if (!sub) if (!sub)
goto fail; return AVERROR(ENOMEM);
if (new_event) { if (new_event) {
sub->pts = frame; sub->pts = frame;
sub->duration = -1; sub->duration = -1;
...@@ -97,9 +97,6 @@ static int aqt_read_header(AVFormatContext *s) ...@@ -97,9 +97,6 @@ static int aqt_read_header(AVFormatContext *s)
ff_subtitles_queue_finalize(s, &aqt->q); ff_subtitles_queue_finalize(s, &aqt->q);
return 0; return 0;
fail:
ff_subtitles_queue_clean(&aqt->q);
return AVERROR(ENOMEM);
} }
static int aqt_read_packet(AVFormatContext *s, AVPacket *pkt) static int aqt_read_packet(AVFormatContext *s, AVPacket *pkt)
...@@ -141,6 +138,7 @@ const AVInputFormat ff_aqtitle_demuxer = { ...@@ -141,6 +138,7 @@ const AVInputFormat ff_aqtitle_demuxer = {
.name = "aqtitle", .name = "aqtitle",
.long_name = NULL_IF_CONFIG_SMALL("AQTitle subtitles"), .long_name = NULL_IF_CONFIG_SMALL("AQTitle subtitles"),
.priv_data_size = sizeof(AQTitleContext), .priv_data_size = sizeof(AQTitleContext),
.flags_internal = FF_FMT_INIT_CLEANUP,
.read_probe = aqt_probe, .read_probe = aqt_probe,
.read_header = aqt_read_header, .read_header = aqt_read_header,
.read_packet = aqt_read_packet, .read_packet = aqt_read_packet,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment