* [FFmpeg-devel] [PATCH] libjxldec/libjxlenc: fix leaks (PR #20352)
@ 2025-08-27 12:11 Leo Izen via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Leo Izen via ffmpeg-devel @ 2025-08-27 12:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Leo Izen
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-27 12:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-27 12:11 [FFmpeg-devel] [PATCH] libjxldec/libjxlenc: fix leaks (PR #20352) Leo Izen 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