Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Leo Izen via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Leo Izen <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] libjxldec/libjxlenc: fix leaks (PR #20352)
Message-ID: <175629665363.34.6058604134571774466@5a0384606a8e> (raw)

PR #20352 opened by Leo Izen (Traneptora)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20352
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20352.patch

Fix leaks. We forgot to free these.


>From a8d6b87a4442c690587db6f44cc7ed72a2de81fc Mon Sep 17 00:00:00 2001
From: Leo Izen <leo.izen@gmail.com>
Date: Wed, 27 Aug 2025 05:26:03 -0400
Subject: [PATCH 1/2] avcodec/libjxldec: fix leaked EXIF ifd

We're missing a call to av_exif_free here. We leak the internal heap-
allocated objects when &ifd goes out of scope.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
 libavcodec/libjxldec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index 31f4592d1c..8ce69015bf 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -519,6 +519,7 @@ static int libjxl_receive_frame(AVCodecContext *avctx, AVFrame *frame)
                 ret = ff_decode_exif_attach_ifd(avctx, ctx->frame, &ifd);
                 if (ret < 0)
                     av_log(avctx, AV_LOG_ERROR, "Unable to attach EXIF ifd\n");
+                av_exif_free(&ifd);
             }
             if (ctx->basic_info.have_animation) {
                 ctx->frame->pts = av_rescale_q(ctx->accumulated_pts, ctx->anim_timebase, avctx->pkt_timebase);
-- 
2.49.1


>From 041651841a1e11a6873a1d7b2f826b8678f8a2c8 Mon Sep 17 00:00:00 2001
From: Leo Izen <leo.izen@gmail.com>
Date: Wed, 27 Aug 2025 05:28:31 -0400
Subject: [PATCH 2/2] avcodec/libjxlenc: fix leaked EXIF ifd

We're missing a call to av_exif_free here. We leak the internal heap-
allocated objects when &ifd goes out of scope.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
 libavcodec/libjxlenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c
index 4f05f015e2..81c8233e40 100644
--- a/libavcodec/libjxlenc.c
+++ b/libavcodec/libjxlenc.c
@@ -394,6 +394,7 @@ static int libjxl_preprocess_stream(AVCodecContext *avctx, const AVFrame *frame,
             ret = av_exif_write(avctx, &ifd, &exif_buffer, AV_EXIF_TIFF_HEADER);
         if (ret < 0)
             av_log(avctx, AV_LOG_WARNING, "unable to process EXIF frame data\n");
+        av_exif_free(&ifd);
     } else {
         sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
         if (sd)
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-08-27 12:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=175629665363.34.6058604134571774466@5a0384606a8e \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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