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.i...@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.i...@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.i...@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.i...@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-le...@ffmpeg.org