diff mbox series

[FFmpeg-devel,18/21] avfilter/vf_hwdownload: Fix leak of formats list upon error

Message ID 20200809155748.30092-12-andreas.rheinhardt@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/6] avfilter/formats: Remove ff_make_formatu64_list()
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 9, 2020, 3:57 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavfilter/vf_hwdownload.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_hwdownload.c b/libavfilter/vf_hwdownload.c
index 33af30cf40..ce10b60e59 100644
--- a/libavfilter/vf_hwdownload.c
+++ b/libavfilter/vf_hwdownload.c
@@ -55,11 +55,11 @@  static int hwdownload_query_formats(AVFilterContext *avctx)
         }
     }
 
-    if ((err = ff_formats_ref(infmts,  &avctx->inputs[0]->out_formats)) < 0 ||
-        (err = ff_formats_ref(outfmts, &avctx->outputs[0]->in_formats)) < 0)
+    if ((err = ff_formats_ref(infmts,  &avctx->inputs[0]->out_formats)) < 0) {
+        ff_formats_unref(&outfmts);
         return err;
-
-    return 0;
+    }
+    return ff_formats_ref(outfmts, &avctx->outputs[0]->in_formats);
 }
 
 static int hwdownload_config_input(AVFilterLink *inlink)