[FFmpeg-devel] [PATCH 08/23] avfilter/af_ladspa: Free inpads' names generically

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


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

diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c
index 4060251670..cbb8282988 100644
--- a/libavfilter/af_ladspa.c
+++ b/libavfilter/af_ladspa.c
@@ -456,7 +456,7 @@ static av_cold int init(AVFilterContext *ctx)
     AVFilterPad pad = { NULL };
     char *p, *arg, *saveptr = NULL;
     unsigned long nb_ports;
-    int i, j = 0;
+    int i, j = 0, ret;
 
     if (!s->dl_name) {
         av_log(ctx, AV_LOG_ERROR, "No plugin name provided\n");
@@ -639,10 +639,8 @@ static av_cold int init(AVFilterContext *ctx)
 
         pad.filter_frame = filter_frame;
         pad.config_props = config_input;
-        if (ff_insert_inpad(ctx, ctx->nb_inputs, &pad) < 0) {
-            av_freep(&pad.name);
-            return AVERROR(ENOMEM);
-        }
+        if ((ret = ff_insert_inpad(ctx, ctx->nb_inputs, &pad)) < 0)
+            return ret;
     }
 
     av_log(ctx, AV_LOG_DEBUG, "ports: %lu\n", nb_ports);
@@ -764,9 +762,6 @@ static av_cold void uninit(AVFilterContext *ctx)
     av_freep(&s->octlv);
     av_freep(&s->handles);
     av_freep(&s->ctl_needs_value);
-
-    if (ctx->nb_inputs)
-        av_freep(&ctx->input_pads[0].name);
 }
 
 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
@@ -803,4 +798,5 @@ const AVFilter ff_af_ladspa = {
     .inputs        = 0,
     .outputs       = ladspa_outputs,
     .flags         = AVFILTER_FLAG_DYNAMIC_INPUTS,
+    .flags_internal = FF_FILTER_FLAG_FREE_INPADS,
 };
-- 
2.30.2



More information about the ffmpeg-devel mailing list