diff mbox series

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

Message ID AM7PR03MB6660C93A1DDAD5ECF761E72F8FFE9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Superseded
Headers show
Series [FFmpeg-devel,1/6] avfilter/internal: Replace AVFilterPad.needs_writable by flags | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 17, 2021, 1:53 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@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 mbox series

Patch

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) {