[FFmpeg-cvslog] lavfi/avfiltergraph: fix leak on error

Marvin Scholz git at videolan.org
Mon Sep 9 13:27:46 EEST 2024


ffmpeg | branch: master | Marvin Scholz <epirat07 at gmail.com> | Thu Sep  5 03:13:13 2024 +0200| [9556379943b6c221def0022f4ce31343b91ec7f3] | committer: Anton Khirnov

lavfi/avfiltergraph: fix leak on error

Introduced in eddffbedb3443d5a4fe642de6e35b9e6a35cfda7

Fixes: CID1618897 Resource leak
Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9556379943b6c221def0022f4ce31343b91ec7f3
---

 libavfilter/avfiltergraph.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index c84dd3cf25..3946f04b53 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -372,8 +372,10 @@ static int filter_query_formats(AVFilterContext *ctx)
 
         if (ctx->nb_outputs > FF_ARRAY_ELEMS(cfg_out_stack)) {
             cfg_out_dyn = av_malloc_array(ctx->nb_outputs, sizeof(*cfg_out_dyn));
-            if (!cfg_out_dyn)
+            if (!cfg_out_dyn) {
+                av_freep(&cfg_in_dyn);
                 return AVERROR(ENOMEM);
+            }
             cfg_out = cfg_out_dyn;
         } else
             cfg_out = ctx->nb_outputs ? cfg_out_stack : NULL;



More information about the ffmpeg-cvslog mailing list