avformat/sccdec: 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 f3c63e67bb)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-06-14 03:22:32 +02:00
parent 5c9f00b47e
commit 6b7af5991a
1 changed files with 4 additions and 1 deletions

View File

@ -133,7 +133,7 @@ try_again:
sub = ff_subtitles_queue_insert(&scc->q, out, i, 0);
if (!sub)
return AVERROR(ENOMEM);
goto fail;
sub->pos = pos;
sub->pts = ts_start;
@ -149,6 +149,9 @@ try_again:
ff_subtitles_queue_finalize(s, &scc->q);
return ret;
fail:
ff_subtitles_queue_clean(&scc->q);
return AVERROR(ENOMEM);
}
static int scc_read_packet(AVFormatContext *s, AVPacket *pkt)