diff mbox series

[FFmpeg-devel,2/5] avfilter/avfilter: Actually error out on init error

Message ID AM7PR03MB6660FE8E19BD4E916ABCDF738FDB9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 10ad3cd7982e5a5d922cabd176c97571a7684c60
Headers show
Series [FFmpeg-devel,1/5] avcodec/avcodec: Set options only once via AV_OPT_SEARCH_CHILDREN
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 15, 2021, 5:22 p.m. UTC
Currently an error from init could be overwritten by successfully
setting the enable expression.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/avfilter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Nicolas George Sept. 15, 2021, 5:24 p.m. UTC | #1
Andreas Rheinhardt (12021-09-15):
> Currently an error from init could be overwritten by successfully
> setting the enable expression.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavfilter/avfilter.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Ok.

Regards,
diff mbox series

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index c614eb0740..ce63b9762f 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -924,6 +924,8 @@  int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
         ret = ctx->filter->init(ctx);
     else if (ctx->filter->init_dict)
         ret = ctx->filter->init_dict(ctx, options);
+    if (ret < 0)
+        return ret;
 
     if (ctx->enable_str) {
         ret = set_enable_expr(ctx, ctx->enable_str);
@@ -931,7 +933,7 @@  int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
             return ret;
     }
 
-    return ret;
+    return 0;
 }
 
 int avfilter_init_str(AVFilterContext *filter, const char *args)