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

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sun Aug 9 18:57:45 EEST 2020


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavfilter/vf_hwdownload.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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)
-- 
2.20.1



More information about the ffmpeg-devel mailing list