diff mbox series

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

Message ID D3XYAJQ7WYLS.QIMB7HCLP9PT@gmail.com
State New
Headers show
Series [FFmpeg-devel] lavfi/avfiltergraph: fix leak on error | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marvin Scholz Sept. 5, 2024, 1:13 a.m. UTC
Introduced in eddffbedb3443d5a4fe642de6e35b9e6a35cfda7

Fixes: CID1618897 Resource leak
---
 libavfilter/avfiltergraph.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


base-commit: d9f594209fb1a9c87017034f943dcb311a9d2896
diff mbox series

Patch

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;