Now compiling and not leaking:

diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 5020684a28..8ca5189202 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -141,6 +141,8 @@ void dec_free(Decoder **pdec)
     av_freep(&dp->views_requested);
     av_freep(&dp->view_map);
+ av_freep(&dec->subtitle_header);
+
     av_freep(pdec);
 }
@@ -1621,7 +1623,11 @@ static int dec_open(DecoderPriv *dp, AVDictionary **dec_opts,
             dp->dec_ctx->extra_hw_frames = extra_frames;
     }
- dp->dec.subtitle_header = dp->dec_ctx->subtitle_header;
+    if (dp->dec_ctx->subtitle_header) {
+        dp->dec.subtitle_header = av_memdup(dp->dec_ctx->subtitle_header, 
dp->dec_ctx->subtitle_header_size);
+        if (!dp->dec.subtitle_header)
+            return AVERROR(ENOMEM);
+    }
     dp->dec.subtitle_header_size = dp->dec_ctx->subtitle_header_size;
if (param_out) {

On 1/30/2026 1:05 PM, James Almer wrote:
Does this fix it?

diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 5020684a28..5dca26fbb2 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -1621,7 +1621,11 @@ static int dec_open(DecoderPriv *dp, AVDictionary **dec_opts,
             dp->dec_ctx->extra_hw_frames = extra_frames;
     }

-    dp->dec.subtitle_header      = dp->dec_ctx->subtitle_header;
+    if (dp->dec_ctx->subtitle_header) {
+        dp->dec.subtitle_header) = av_memdup(dp->dec_ctx- >subtitle_header, dp->dec_ctx->subtitle_header_size);
+        if (!dp->dec.subtitle_header)
+            return AVERROR(ENOMEM);
+    }
     dp->dec.subtitle_header_size = dp->dec_ctx->subtitle_header_size;

     if (param_out) {


Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to