Commit fe635ba33b for ffmpeg
commit fe635ba33ba856f90667cbfaa23cda20b590c185
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Sun Nov 8 14:07:03 2026 +0100
avfilter/vf_lcevc: allocate the base picture after the enhancement data was accepted
When LCEVC_SendDecoderEnhancementData() failed, the picture allocated
for the base frame was not freed.
Fixes: memleak
Fixes: a4b506JEoHv4
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25134
Memleak Replicated through Modified FFmpeg with the LCEVCdec unreleased
picture log
diff --git a/libavfilter/vf_lcevc.c b/libavfilter/vf_lcevc.c
index 6fe6edb61f..c2b6f29926 100644
--- a/libavfilter/vf_lcevc.c
+++ b/libavfilter/vf_lcevc.c
@@ -150,10 +150,6 @@ static int send_frame(AVFilterLink *inlink, AVFrame *in)
LCEVC_ReturnCode res;
int ret;
- ret = alloc_base_frame(inlink, in, &picture);
- if (ret < 0)
- return ret;
-
if (sd) {
res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, in->pts, sd->data, sd->size);
if (res == LCEVC_Again)
@@ -164,6 +160,10 @@ static int send_frame(AVFilterLink *inlink, AVFrame *in)
}
}
+ ret = alloc_base_frame(inlink, in, &picture);
+ if (ret < 0)
+ return ret;
+
res = LCEVC_SetPictureUserData(lcevc->decoder, picture, in);
if (res != LCEVC_Success) {
av_log(ctx, AV_LOG_ERROR, "LCEVC_SetPictureUserData failed\n");