Browse Source

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>
tags/n3.4.8
Andreas Rheinhardt 5 years ago
parent
commit
abf63fef43
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavformat/sccdec.c

+ 4
- 1
libavformat/sccdec.c View File

@@ -132,7 +132,7 @@ static int scc_read_header(AVFormatContext *s)


sub = ff_subtitles_queue_insert(&scc->q, out, i, 0); sub = ff_subtitles_queue_insert(&scc->q, out, i, 0);
if (!sub) if (!sub)
return AVERROR(ENOMEM);
goto fail;


sub->pos = pos; sub->pos = pos;
sub->pts = ts_start; sub->pts = ts_start;
@@ -144,6 +144,9 @@ static int scc_read_header(AVFormatContext *s)
ff_subtitles_queue_finalize(s, &scc->q); ff_subtitles_queue_finalize(s, &scc->q);


return ret; return ret;
fail:
ff_subtitles_queue_clean(&scc->q);
return AVERROR(ENOMEM);
} }


static int scc_read_packet(AVFormatContext *s, AVPacket *pkt) static int scc_read_packet(AVFormatContext *s, AVPacket *pkt)


Loading…
Cancel
Save