1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-10-06 05:47:18 +02:00

avformat/movenc_ttml: fix memleaks

Memory leaks can happen on normal case when break from while loop
early, and it can happen on error path with goto cleanup.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
Zhao Zhili
2025-09-23 22:08:02 +08:00
parent cb4052beae
commit 1a02412170

View File

@@ -140,7 +140,7 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
} else if (pkt->pts >= end_ts) {
// starts after this fragment, put back to original queue
ret = avpriv_packet_list_put(&track->squashed_packet_queue,
pkt, av_packet_ref,
pkt, NULL,
FF_PACKETLIST_FLAG_PREPEND);
if (ret < 0)
goto cleanup;
@@ -215,6 +215,7 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
ret = 0;
cleanup:
av_packet_unref(pkt);
while (!avpriv_packet_list_get(&back_to_queue_list, pkt)) {
ret = avpriv_packet_list_put(&track->squashed_packet_queue,
pkt, av_packet_ref,