[FFmpeg-devel] [PATCH 18/23] avfilter/vf_mix: Free inpads' names generically

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


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

diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c
index 0ca60d5522..9f1400e729 100644
--- a/libavfilter/vf_mix.c
+++ b/libavfilter/vf_mix.c
@@ -125,10 +125,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;
-            }
         }
     }
 
@@ -303,10 +301,7 @@ static av_cold void uninit(AVFilterContext *ctx)
     ff_framesync_uninit(&s->fs);
     av_freep(&s->weights);
 
-    if (!s->tmix) {
-        for (i = 0; i < ctx->nb_inputs; i++)
-            av_freep(&ctx->input_pads[i].name);
-    } else {
+    if (s->tmix) {
         for (i = 0; i < s->nb_frames && s->frames; i++)
             av_frame_free(&s->frames[i]);
     }
@@ -370,6 +365,7 @@ const AVFilter ff_vf_mix = {
     .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