* [FFmpeg-devel] [PATCH] Handle errors in ogg reinit, make sure we free private data before new (PR #20877)
@ 2025-11-09 18:51 toots via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: toots via ffmpeg-devel @ 2025-11-09 18:51 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: toots
PR #20877 opened by toots
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20877
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20877.patch
>From 389a1df1e310c7a76f857137d321d455271d5719 Mon Sep 17 00:00:00 2001
From: Romain Beauxis <romain.beauxis@gmail.com>
Date: Sun, 9 Nov 2025 12:49:32 -0600
Subject: [PATCH] Handle errors in ogg reinit, make sure we free private data
before new init.
---
libavformat/oggenc.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 5cd94b49bc..080af2295f 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -649,16 +649,27 @@ static int ogg_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);
if (side_metadata && oggstream->packet_written) {
- ogg_write_trailer(s);
+ ret = ogg_write_trailer(s);
+ if (ret < 0)
+ return ret;
+
ogg_deinit(s);
+ av_freep(&st->priv_data);
av_dict_free(&st->metadata);
ret = av_packet_unpack_dictionary(side_metadata, size, &st->metadata);
if (ret < 0)
return ret;
- ogg_init(s);
- ogg_write_header(s);
+ ret = ogg_init(s);
+ if (ret < 0)
+ return ret;
+
+ oggstream = st->priv_data;
+
+ ret = ogg_write_header(s);
+ if (ret < 0)
+ return ret;
}
oggstream->packet_written = 1;
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-11-09 18:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-09 18:51 [FFmpeg-devel] [PATCH] Handle errors in ogg reinit, make sure we free private data before new (PR #20877) toots via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git