summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2024-02-17 21:50:01 +0100
committerAnton Khirnov <anton@khirnov.net>2024-03-04 14:03:17 +0100
commitf00d9bc8bc593651e4eade85b383f2c2be5369ce (patch)
tree8272e5304bec74f70df6dad383497dcbac2b0891
parent87b66dd547e35afea51d2f76bc84c58a198c5e45 (diff)
avcodec/libjxldec: respect side data preference
Also fixes a memory leak where the side data was previously not properly cleaned up on OOM. Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavcodec/libjxldec.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index b830eee784..d57a27418f 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -483,11 +483,9 @@ static int libjxl_receive_frame(AVCodecContext *avctx, AVFrame *frame)
/* full image is one frame, even if animated */
av_log(avctx, AV_LOG_DEBUG, "FULL_IMAGE event emitted\n");
if (ctx->iccp) {
- AVFrameSideData *sd = av_frame_new_side_data_from_buf(ctx->frame, AV_FRAME_DATA_ICC_PROFILE, ctx->iccp);
- if (!sd)
- return AVERROR(ENOMEM);
- /* ownership is transfered, and it is not ref-ed */
- ctx->iccp = NULL;
+ ret = ff_frame_new_side_data_from_buf(avctx, ctx->frame, AV_FRAME_DATA_ICC_PROFILE, &ctx->iccp, NULL);
+ if (ret < 0)
+ return ret;
}
if (ctx->basic_info.have_animation) {
ctx->frame->pts = av_rescale_q(ctx->accumulated_pts, ctx->anim_timebase, avctx->pkt_timebase);