mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
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@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
5acef12061
commit
6bd8bcc2ac
@ -132,9 +132,10 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
|
|||||||
if (!subs)
|
if (!subs)
|
||||||
return NULL;
|
return NULL;
|
||||||
q->subs = subs;
|
q->subs = subs;
|
||||||
sub = &subs[q->nb_subs++];
|
sub = &subs[q->nb_subs];
|
||||||
if (av_new_packet(sub, len) < 0)
|
if (av_new_packet(sub, len) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
q->nb_subs++;
|
||||||
sub->flags |= AV_PKT_FLAG_KEY;
|
sub->flags |= AV_PKT_FLAG_KEY;
|
||||||
sub->pts = sub->dts = 0;
|
sub->pts = sub->dts = 0;
|
||||||
memcpy(sub->data, event, len);
|
memcpy(sub->data, event, len);
|
||||||
|
Loading…
Reference in New Issue
Block a user