mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 19:30:05 +00:00
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)
This commit is contained in:
parent
30d66abc80
commit
7c0a9ff9c0
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user