[FFmpeg-devel] [PATCH 13/23] avfilter/f_streamselect: Free pads' names generically

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


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

diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c
index 22eb76d4d7..7762cdb3d1 100644
--- a/libavfilter/f_streamselect.c
+++ b/libavfilter/f_streamselect.c
@@ -172,11 +172,8 @@ static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int
             pad.config_props  = config_output;
             ret = ff_insert_outpad(ctx, i, &pad);
         }
-
-        if (ret < 0) {
-            av_freep(&pad.name);
+        if (ret < 0)
             return ret;
-        }
     }
 
     return 0;
@@ -295,12 +292,6 @@ static av_cold void uninit(AVFilterContext *ctx)
     av_freep(&s->map);
     av_freep(&s->frames);
     ff_framesync_uninit(&s->fs);
-
-    for (int i = 0; i < ctx->nb_inputs; i++)
-        av_freep(&ctx->input_pads[i].name);
-
-    for (int i = 0; i < ctx->nb_outputs; i++)
-        av_freep(&ctx->output_pads[i].name);
 }
 
 static int query_formats(AVFilterContext *ctx)
@@ -338,6 +329,7 @@ const AVFilter ff_vf_streamselect = {
     .priv_size       = sizeof(StreamSelectContext),
     .priv_class      = &streamselect_class,
     .flags           = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,
+    .flags_internal  = FF_FILTER_FLAG_FREE_OUTPADS | FF_FILTER_FLAG_FREE_INPADS,
 };
 
 #define astreamselect_options streamselect_options
@@ -354,4 +346,5 @@ const AVFilter ff_af_astreamselect = {
     .priv_size       = sizeof(StreamSelectContext),
     .priv_class      = &astreamselect_class,
     .flags           = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,
+    .flags_internal  = FF_FILTER_FLAG_FREE_OUTPADS | FF_FILTER_FLAG_FREE_INPADS,
 };
-- 
2.30.2



More information about the ffmpeg-devel mailing list