[FFmpeg-devel] [PATCH 6/6] avfilter/af_afir: Free inpads' names generically

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Aug 17 04:53:58 EEST 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
This is how one of the two filters that make use of setting
AVFITLERPAD_FLAG_FREE_NAME directly are handled now.
headphone is the other one. Furthermore, the newly added segment filters
can also be simplified by this method.
I think I can avoid (re)sending the rest of the patchset.
If you think otherwise, just say so and I will send it.

 libavfilter/af_afir.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index 670a8c837b..f26ca03810 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -792,9 +792,6 @@ static av_cold void uninit(AVFilterContext *ctx)
         av_frame_free(&s->ir[i]);
     }
 
-    for (unsigned i = 1; i < ctx->nb_inputs; i++)
-        av_freep(&ctx->input_pads[i].name);
-
     av_frame_free(&s->video);
 }
 
@@ -844,16 +841,15 @@ static av_cold int init(AVFilterContext *ctx)
         pad = (AVFilterPad) {
             .name = av_asprintf("ir%d", n),
             .type = AVMEDIA_TYPE_AUDIO,
+            .flags = AVFILTERPAD_FLAG_FREE_NAME,
         };
 
         if (!pad.name)
             return AVERROR(ENOMEM);
 
         ret = ff_insert_inpad(ctx, &pad);
-        if (ret < 0) {
-            av_freep(&pad.name);
+        if (ret < 0)
             return ret;
-        }
     }
 
     pad = (AVFilterPad) {
-- 
2.30.2



More information about the ffmpeg-devel mailing list