[FFmpeg-cvslog] avformat/subtitles: Don't increment packet counter prematurely
Andreas Rheinhardt
git at videolan.org
Fri Jul 3 20:29:36 EEST 2020
ffmpeg | branch: release/3.2 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sat Mar 21 04:50:20 2020 +0100| [c790095828223d9eb405c0ac62a6ef3c9a8a9966] | committer: Andreas Rheinhardt
avformat/subtitles: Don't increment packet counter prematurely
Do it only if the packet has been successfully allocated in
av_new_packet() -- otherwise on error a completely uninitialized packet
would be unreferenced later.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 6bd8bcc2ac4c64577d964552317989e61db794d8)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c790095828223d9eb405c0ac62a6ef3c9a8a9966
---
libavformat/subtitles.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index f818b1c1a0..98df68d948 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -132,9 +132,10 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
if (!subs)
return NULL;
q->subs = subs;
- sub = &subs[q->nb_subs++];
+ sub = &subs[q->nb_subs];
if (av_new_packet(sub, len) < 0)
return NULL;
+ q->nb_subs++;
sub->flags |= AV_PKT_FLAG_KEY;
sub->pts = sub->dts = 0;
memcpy(sub->data, event, len);
More information about the ffmpeg-cvslog
mailing list