Commit c67ac1bc34 for ffmpeg
commit c67ac1bc34440829de4ef3b9d15206bb095eed11
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Sat Oct 24 05:46:56 2026 +0200
avcodec/libsvtav1: unreference the input frame when eb_send_frame() fails
eb_receive_packet() moves the next input frame into svt_enc->frame but
returned without unreferencing it when eb_send_frame() failed, for
example when Dolby Vision RPU coding is enabled and a frame carries no
AV_FRAME_DATA_DOVI_METADATA. The next call moves another frame over the
still referenced one, which leaks its buffers, or aborts in
av_frame_move_ref() when assertions are enabled.
Fixes: memleak
Fixes: assertion failure
Fixes: 3Vs9X1NJfz1H (AISLE-2026-0150-00864)
Memleak Replicated through API with ASAN
Assertion failure in av_frame_move_ref() Replicated through API
Found-by: Joshua Rogers <joshua.rogers@aisle.com>
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 0bcc176243..1e5732f45d 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -664,9 +664,9 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
frame = NULL;
ret = eb_send_frame(avctx, frame);
+ av_frame_unref(svt_enc->frame);
if (ret < 0)
return ret;
- av_frame_unref(svt_enc->frame);
svt_ret = svt_av1_enc_get_packet(svt_enc->svt_handle, &headerPtr, svt_enc->eos_flag);
if (svt_ret == EB_NoErrorEmptyQueue)