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.
This commit is contained in:
jiangjie
2026-05-13 20:11:19 +08:00
parent 4851060ccd
commit 22d06b39ce
+1
View File
@@ -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;