[FFmpeg-devel] [PATCH 10/23] avfilter/avf_concat: Free pads' names generically

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


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

diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
index 333a0b090c..0ff7cb20b0 100644
--- a/libavfilter/avf_concat.c
+++ b/libavfilter/avf_concat.c
@@ -317,10 +317,8 @@ static av_cold int init(AVFilterContext *ctx)
                     .get_audio_buffer = get_audio_buffer,
                 };
                 pad.name = av_asprintf("in%d:%c%d", seg, "va"[type], str);
-                if ((ret = ff_insert_inpad(ctx, ctx->nb_inputs, &pad)) < 0) {
-                    av_freep(&pad.name);
+                if ((ret = ff_insert_inpad(ctx, ctx->nb_inputs, &pad)) < 0)
                     return ret;
-                }
             }
         }
     }
@@ -332,10 +330,8 @@ static av_cold int init(AVFilterContext *ctx)
                 .config_props  = config_output,
             };
             pad.name = av_asprintf("out:%c%d", "va"[type], str);
-            if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) {
-                av_freep(&pad.name);
+            if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0)
                 return ret;
-            }
         }
     }
 
@@ -349,12 +345,7 @@ static av_cold int init(AVFilterContext *ctx)
 static av_cold void uninit(AVFilterContext *ctx)
 {
     ConcatContext *cat = ctx->priv;
-    unsigned i;
 
-    for (i = 0; i < ctx->nb_inputs; i++)
-        av_freep(&ctx->input_pads[i].name);
-    for (i = 0; i < ctx->nb_outputs; i++)
-        av_freep(&ctx->output_pads[i].name);
     av_freep(&cat->in);
 }
 
@@ -463,5 +454,6 @@ const AVFilter ff_avf_concat = {
     .outputs       = NULL,
     .priv_class    = &concat_class,
     .flags         = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,
+    .flags_internal = FF_FILTER_FLAG_FREE_INPADS | FF_FILTER_FLAG_FREE_OUTPADS,
     .process_command = process_command,
 };
-- 
2.30.2



More information about the ffmpeg-devel mailing list