diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index 2af0450e86..21d68a9739 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -85,7 +85,9 @@ int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt) if (q->current_sub_idx == q->nb_subs) return AVERROR_EOF; - av_copy_packet(pkt, sub); + if (av_copy_packet(pkt, sub) < 0) { + return AVERROR(ENOMEM); + } pkt->dts = pkt->pts; q->current_sub_idx++;