mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-20 13:57:00 +00:00
avformat/utils: Fix memleak when decoding subtitle in find_stream_info
avformat_find_stream_info() may decode some frames to get stream information. And when it does this for subtitles, the decoded subtitles leak. (Decoding subtitles was added inb1511e00f6
for PGS subtitles. When PGS subtitles originate from a container that exports every segment as a packet of its own, no output will be generated when decoding a packet, because not enough input is available. Yet when used with PGS subtitles in the Matroska form a single packet contains enough data to generate output. Yet said output is not freed, hence this leak.) Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commitd026fef999
)
This commit is contained in:
parent
754d63e9d2
commit
df88108c97
@ -3092,6 +3092,8 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt,
|
||||
} else if (avctx->codec_type == AVMEDIA_TYPE_SUBTITLE) {
|
||||
ret = avcodec_decode_subtitle2(avctx, &subtitle,
|
||||
&got_picture, &pkt);
|
||||
if (got_picture)
|
||||
avsubtitle_free(&subtitle);
|
||||
if (ret >= 0)
|
||||
pkt.size = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user