[FFmpeg-devel] [PATCH 16/23] avfilter/vf_extractplanes: Free outpads' names generically

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


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

diff --git a/libavfilter/vf_extractplanes.c b/libavfilter/vf_extractplanes.c
index cede3d669e..52602965ac 100644
--- a/libavfilter/vf_extractplanes.c
+++ b/libavfilter/vf_extractplanes.c
@@ -352,23 +352,13 @@ static av_cold int init(AVFilterContext *ctx)
         pad.type = AVMEDIA_TYPE_VIDEO;
         pad.config_props = config_output;
 
-        if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) {
-            av_freep(&pad.name);
+        if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0)
             return ret;
-        }
     }
 
     return 0;
 }
 
-static av_cold void uninit(AVFilterContext *ctx)
-{
-    int i;
-
-    for (i = 0; i < ctx->nb_outputs; i++)
-        av_freep(&ctx->output_pads[i].name);
-}
-
 static const AVFilterPad extractplanes_inputs[] = {
     {
         .name         = "default",
@@ -385,11 +375,11 @@ const AVFilter ff_vf_extractplanes = {
     .priv_size     = sizeof(ExtractPlanesContext),
     .priv_class    = &extractplanes_class,
     .init          = init,
-    .uninit        = uninit,
     .query_formats = query_formats,
     .inputs        = extractplanes_inputs,
     .outputs       = NULL,
     .flags         = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
+    .flags_internal = FF_FILTER_FLAG_FREE_OUTPADS,
 };
 
 #if CONFIG_ALPHAEXTRACT_FILTER
@@ -409,10 +399,10 @@ const AVFilter ff_vf_alphaextract = {
                       "grayscale image component."),
     .priv_size      = sizeof(ExtractPlanesContext),
     .init           = init_alphaextract,
-    .uninit         = uninit,
     .query_formats  = query_formats,
     .inputs         = extractplanes_inputs,
     .outputs        = NULL,
     .flags          = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
+    .flags_internal = FF_FILTER_FLAG_FREE_OUTPADS,
 };
 #endif  /* CONFIG_ALPHAEXTRACT_FILTER */
-- 
2.30.2



More information about the ffmpeg-devel mailing list