PR #23092 opened by jiangjie URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23092 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23092.patch
When ff_filter_alloc fails after the name has been allocated (via av_strdup), the error handling code frees inputs and input_pads but misses freeing ret->name, causing a memory leak. Add av_freep(&ret->name) in the error path before freeing inputs. >From 22d06b39ce0545ce597f090d84f60c1a2b04fd25 Mon Sep 17 00:00:00 2001 From: jiangjie <[email protected]> Date: Wed, 13 May 2026 20:06:06 +0800 Subject: [PATCH] avfilter/avfilter: fix memory leak of filter name in ff_filter_alloc error path When ff_filter_alloc fails after the name has been allocated (via av_strdup), the error handling code frees inputs and input_pads but misses freeing ret->name, causing a memory leak. Add av_freep(&ret->name) in the error path before freeing inputs. --- libavfilter/avfilter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index bb0b665f0c..b15f0b08b4 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -760,6 +760,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) err: if (preinited) fi->uninit(ret); + av_freep(&ret->name); av_freep(&ret->inputs); av_freep(&ret->input_pads); ret->nb_inputs = 0; -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
