[FFmpeg-devel] [PATCH 21/23] avfilter/vf_stack: Free inpads' names generically

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


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

diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
index 3368e25c9c..33cef09a91 100644
--- a/libavfilter/vf_stack.c
+++ b/libavfilter/vf_stack.c
@@ -123,10 +123,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;
@@ -371,14 +369,10 @@ static int config_output(AVFilterLink *outlink)
 static av_cold void uninit(AVFilterContext *ctx)
 {
     StackContext *s = ctx->priv;
-    int i;
 
     ff_framesync_uninit(&s->fs);
     av_freep(&s->frames);
     av_freep(&s->items);
-
-    for (i = 0; i < ctx->nb_inputs; i++)
-        av_freep(&ctx->input_pads[i].name);
 }
 
 static int activate(AVFilterContext *ctx)
@@ -420,6 +414,7 @@ const AVFilter ff_vf_hstack = {
     .uninit        = uninit,
     .activate      = activate,
     .flags         = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_SLICE_THREADS,
+    .flags_internal = FF_FILTER_FLAG_FREE_INPADS,
 };
 
 #endif /* CONFIG_HSTACK_FILTER */
@@ -440,6 +435,7 @@ const AVFilter ff_vf_vstack = {
     .uninit        = uninit,
     .activate      = activate,
     .flags         = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_SLICE_THREADS,
+    .flags_internal = FF_FILTER_FLAG_FREE_INPADS,
 };
 
 #endif /* CONFIG_VSTACK_FILTER */
@@ -467,6 +463,7 @@ const AVFilter ff_vf_xstack = {
     .uninit        = uninit,
     .activate      = activate,
     .flags         = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_SLICE_THREADS,
+    .flags_internal = FF_FILTER_FLAG_FREE_INPADS,
 };
 
 #endif /* CONFIG_XSTACK_FILTER */
-- 
2.30.2



More information about the ffmpeg-devel mailing list