[FFmpeg-devel] [PATCH 15/19] avfilter/vf_signature: Fix leak of inpads' names

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Tue Aug 25 17:09:23 EEST 2020


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
It is not intended for these added lines to live very long: One can add
flags to AVFilter.flags_internal that indicate that this filter wants
the inpads/outpads' names be freed generically. This will allow to
remove most of the code for freeing in/outpads. These flags can also be
used to make ff_insert_in/outpad free the name itself upon error.

Furthermore, one can make ff_insert_pad() return AVERROR(ENOMEM) if the
name of the pad that is about to be inserted is NULL; this allows to
remove the checks for allocation failure from the callers.

 libavfilter/vf_signature.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
index 5ea55d5247..d09003746c 100644
--- a/libavfilter/vf_signature.c
+++ b/libavfilter/vf_signature.c
@@ -730,6 +730,8 @@ static av_cold void uninit(AVFilterContext *ctx)
         }
         av_freep(&sic->streamcontexts);
     }
+    for (unsigned i = 0; i < ctx->nb_inputs; i++)
+        av_freep(&ctx->input_pads[i].name);
 }
 
 static int config_output(AVFilterLink *outlink)
-- 
2.20.1



More information about the ffmpeg-devel mailing list