Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-14 04:04:29 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-07-02 11:15:08 +0300
commit7a1a1542a0ab079f08dc5b38dba1641ffe4e7691 (patch)
treec0ce65566f5409e50e8463cd2ba87eeecc490129
parent85200b8c026b938b09dee016b5729afde880d850 (diff)
avformat/aqtitledec: Fix memleak upon read header failure
The already parsed subtitles (contained in an FFDemuxSubtitlesQueue) would leak if an error happened upon reading a subsequent subtitle. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commit a86a5d06d8967d01964833456df1df9fc186f125) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavformat/aqtitledec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/aqtitledec.c b/libavformat/aqtitledec.c
index f0e840b0f7..317547c4f4 100644
--- a/libavformat/aqtitledec.c
+++ b/libavformat/aqtitledec.c
@@ -81,11 +81,11 @@ static int aqt_read_header(AVFormatContext *s)
if (!new_event) {
sub = ff_subtitles_queue_insert(&aqt->q, "\n", 1, 1);
if (!sub)
- return AVERROR(ENOMEM);
+ goto fail;
}
sub = ff_subtitles_queue_insert(&aqt->q, line, strlen(line), !new_event);
if (!sub)
- return AVERROR(ENOMEM);
+ goto fail;
if (new_event) {
sub->pts = frame;
sub->duration = -1;
@@ -97,6 +97,9 @@ static int aqt_read_header(AVFormatContext *s)
ff_subtitles_queue_finalize(s, &aqt->q);
return 0;
+fail:
+ ff_subtitles_queue_clean(&aqt->q);
+ return AVERROR(ENOMEM);
}
static int aqt_read_packet(AVFormatContext *s, AVPacket *pkt)