This function can return ENOMEM that needs to be propagated.

Signed-off-by: Ganesh Ajjanagadde <gajjanaga...@gmail.com>
---
 libavfilter/vf_pad.c    | 12 +++++++-----
 libavfilter/vf_rotate.c |  5 +++--
 libavfilter/vf_scale.c  |  5 +++--
 libavfilter/vf_zscale.c |  5 +++--
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 63dc6a8..a40f5fa 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -114,9 +114,10 @@ static int config_input(AVFilterLink *inlink)
     var_values[VAR_VSUB]  = 1 << s->draw.vsub_max;
 
     /* evaluate width and height */
-    av_expr_parse_and_eval(&res, (expr = s->w_expr),
+    if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr),
                            var_names, var_values,
-                           NULL, NULL, NULL, NULL, NULL, 0, ctx);
+                           NULL, NULL, NULL, NULL, NULL, 0, ctx)) == 
AVERROR(ENOMEM))
+        goto eval_fail;
     s->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res;
     if ((ret = av_expr_parse_and_eval(&res, (expr = s->h_expr),
                                       var_names, var_values,
@@ -126,14 +127,15 @@ static int config_input(AVFilterLink *inlink)
     /* evaluate the width again, as it may depend on the evaluated output 
height */
     if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr),
                                       var_names, var_values,
-                                      NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 
0)
+                                      NULL, NULL, NULL, NULL, NULL, 0, ctx)) 
== AVERROR(ENOMEM))
         goto eval_fail;
     s->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res;
 
     /* evaluate x and y */
-    av_expr_parse_and_eval(&res, (expr = s->x_expr),
+    if ((ret = av_expr_parse_and_eval(&res, (expr = s->x_expr),
                            var_names, var_values,
-                           NULL, NULL, NULL, NULL, NULL, 0, ctx);
+                           NULL, NULL, NULL, NULL, NULL, 0, ctx)) == 
AVERROR(ENOMEM))
+        goto eval_fail;
     s->x = var_values[VAR_X] = res;
     if ((ret = av_expr_parse_and_eval(&res, (expr = s->y_expr),
                                       var_names, var_values,
diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c
index f12a103..035c2e9 100644
--- a/libavfilter/vf_rotate.c
+++ b/libavfilter/vf_rotate.c
@@ -235,8 +235,9 @@ static int config_props(AVFilterLink *outlink)
 } while (0)
 
     /* evaluate width and height */
-    av_expr_parse_and_eval(&res, expr = rot->outw_expr_str, var_names, 
rot->var_values,
-                           func1_names, func1, NULL, NULL, rot, 0, ctx);
+    if ((ret = av_expr_parse_and_eval(&res, expr = rot->outw_expr_str, 
var_names, rot->var_values,
+                           func1_names, func1, NULL, NULL, rot, 0, ctx)) == 
AVERROR(ENOMEM))
+        return ret;
     rot->var_values[VAR_OUT_W] = rot->var_values[VAR_OW] = res;
     rot->outw = res + 0.5;
     SET_SIZE_EXPR(outh, "out_w");
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 1032688..401d837 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -265,9 +265,10 @@ static int config_props(AVFilterLink *outlink)
     var_values[VAR_OVSUB] = 1 << out_desc->log2_chroma_h;
 
     /* evaluate width and height */
-    av_expr_parse_and_eval(&res, (expr = scale->w_expr),
+    if ((ret = av_expr_parse_and_eval(&res, (expr = scale->w_expr),
                            var_names, var_values,
-                           NULL, NULL, NULL, NULL, NULL, 0, ctx);
+                           NULL, NULL, NULL, NULL, NULL, 0, ctx)) == 
AVERROR(ENOMEM))
+        goto fail;
     scale->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res;
     if ((ret = av_expr_parse_and_eval(&res, (expr = scale->h_expr),
                                       var_names, var_values,
diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index 86e5f5f..2b3c11f 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -206,9 +206,10 @@ static int config_props(AVFilterLink *outlink)
     var_values[VAR_OVSUB] = 1 << out_desc->log2_chroma_h;
 
     /* evaluate width and height */
-    av_expr_parse_and_eval(&res, (expr = s->w_expr),
+    if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr),
                            var_names, var_values,
-                           NULL, NULL, NULL, NULL, NULL, 0, ctx);
+                           NULL, NULL, NULL, NULL, NULL, 0, ctx)) == 
AVERROR(ENOMEM))
+        goto fail;
     s->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res;
     if ((ret = av_expr_parse_and_eval(&res, (expr = s->h_expr),
                                       var_names, var_values,
-- 
2.6.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to