[FFmpeg-cvslog] avfilter/af_ladspa: check functions return value in query_formats

Paul B Mahol git at videolan.org
Sun Oct 18 02:02:36 CEST 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Oct 18 02:00:21 2015 +0200| [002b0499b62e8203ed1d64e12228904c99b950c1] | committer: Paul B Mahol

avfilter/af_ladspa: check functions return value in query_formats

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=002b0499b62e8203ed1d64e12228904c99b950c1
---

 libavfilter/af_ladspa.c |   50 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 37 insertions(+), 13 deletions(-)

diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c
index 8908880..c323d2d 100644
--- a/libavfilter/af_ladspa.c
+++ b/libavfilter/af_ladspa.c
@@ -597,22 +597,29 @@ static int query_formats(AVFilterContext *ctx)
     AVFilterChannelLayouts *layouts;
     static const enum AVSampleFormat sample_fmts[] = {
         AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE };
+    int ret;
 
     formats = ff_make_format_list(sample_fmts);
     if (!formats)
         return AVERROR(ENOMEM);
-    ff_set_common_formats(ctx, formats);
+    ret = ff_set_common_formats(ctx, formats);
+    if (ret < 0)
+        return ret;
 
     if (s->nb_inputs) {
         formats = ff_all_samplerates();
         if (!formats)
             return AVERROR(ENOMEM);
 
-        ff_set_common_samplerates(ctx, formats);
+        ret = ff_set_common_samplerates(ctx, formats);
+        if (ret < 0)
+            return ret;
     } else {
         int sample_rates[] = { s->sample_rate, -1 };
 
-        ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates));
+        ret = ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates));
+        if (ret < 0)
+            return ret;
     }
 
     if (s->nb_inputs == 1 && s->nb_outputs == 1) {
@@ -621,11 +628,17 @@ static int query_formats(AVFilterContext *ctx)
         if (!layouts)
             return AVERROR(ENOMEM);
 
-        ff_set_common_channel_layouts(ctx, layouts);
+        ret = ff_set_common_channel_layouts(ctx, layouts);
+        if (ret < 0)
+            return ret;
     } else if (s->nb_inputs == 2 && s->nb_outputs == 2) {
         layouts = NULL;
-        ff_add_channel_layout(&layouts, AV_CH_LAYOUT_STEREO);
-        ff_set_common_channel_layouts(ctx, layouts);
+        ret = ff_add_channel_layout(&layouts, AV_CH_LAYOUT_STEREO);
+        if (ret < 0)
+            return ret;
+        ret = ff_set_common_channel_layouts(ctx, layouts);
+        if (ret < 0)
+            return ret;
     } else {
         AVFilterLink *outlink = ctx->outputs[0];
 
@@ -634,19 +647,30 @@ static int query_formats(AVFilterContext *ctx)
             int64_t inlayout = FF_COUNT2LAYOUT(s->nb_inputs);
 
             layouts = NULL;
-            ff_add_channel_layout(&layouts, inlayout);
-            ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts);
-
-            if (!s->nb_outputs)
-                ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts);
+            ret = ff_add_channel_layout(&layouts, inlayout);
+            if (ret < 0)
+                return ret;
+            ret = ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts);
+            if (ret < 0)
+                return ret;
+
+            if (!s->nb_outputs) {
+                ret = ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts);
+                if (ret < 0)
+                    return ret;
+            }
         }
 
         if (s->nb_outputs >= 1) {
             int64_t outlayout = FF_COUNT2LAYOUT(s->nb_outputs);
 
             layouts = NULL;
-            ff_add_channel_layout(&layouts, outlayout);
-            ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts);
+            ret = ff_add_channel_layout(&layouts, outlayout);
+            if (ret < 0)
+                return ret;
+            ret = ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts);
+            if (ret < 0)
+                return ret;
         }
     }
 



More information about the ffmpeg-cvslog mailing list