[FFmpeg-devel] [PATCH 22/23] avfilter/vf_xmedian: Free inpads' names generically

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Aug 12 04:43:56 EEST 2021


This affects only the xmedian filter, not tmedian.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavfilter/vf_xmedian.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_xmedian.c b/libavfilter/vf_xmedian.c
index 168a5944db..c01f9ff202 100644
--- a/libavfilter/vf_xmedian.c
+++ b/libavfilter/vf_xmedian.c
@@ -121,10 +121,8 @@ static av_cold int init(AVFilterContext *ctx)
         if (!pad.name)
             return AVERROR(ENOMEM);
 
-        if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
-            av_freep(&pad.name);
+        if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0)
             return ret;
-        }
     }
 
     return 0;
@@ -337,8 +335,6 @@ static av_cold void uninit(AVFilterContext *ctx)
 
     ff_framesync_uninit(&s->fs);
 
-    for (int i = 0; i < ctx->nb_inputs && !s->tmedian; i++)
-        av_freep(&ctx->input_pads[i].name);
     for (int i = 0; i < s->nb_frames && s->frames && s->tmedian; i++)
         av_frame_free(&s->frames[i]);
     av_freep(&s->frames);
@@ -404,6 +400,7 @@ const AVFilter ff_vf_xmedian = {
     .activate      = activate,
     .flags         = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_SLICE_THREADS |
                      AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
+    .flags_internal  = FF_FILTER_FLAG_FREE_INPADS,
     .process_command = process_command,
 };
 
-- 
2.30.2



More information about the ffmpeg-devel mailing list