diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-06-14 03:21:03 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-07-01 21:36:51 +0200 |
commit | bdde2f25edccb688658bff0af1fdd3a31e0ded5c (patch) | |
tree | b3aab426285700fd0d0741025abc1380d07bd138 | |
parent | 9542691e95832a0ffb7271c58d771b44910a720e (diff) | |
download | ffmpeg-bdde2f25edccb688658bff0af1fdd3a31e0ded5c.tar.gz |
avformat/pjsdec: 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 9df560e8986640e20c62286f0baee2a80540accd)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavformat/pjsdec.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/pjsdec.c b/libavformat/pjsdec.c index 8a5cc04f84..e30c23d830 100644 --- a/libavformat/pjsdec.c +++ b/libavformat/pjsdec.c @@ -94,8 +94,10 @@ static int pjs_read_header(AVFormatContext *s) p[strcspn(p, "\"")] = 0; sub = ff_subtitles_queue_insert(&pjs->q, p, strlen(p), 0); - if (!sub) + if (!sub) { + ff_subtitles_queue_clean(&pjs->q); return AVERROR(ENOMEM); + } sub->pos = pos; sub->pts = pts_start; sub->duration = duration; |