summaryrefslogtreecommitdiff
path: root/libavfilter/af_join.c
diff options
context:
space:
mode:
authorReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>2014-09-26 12:52:09 -0300
committerReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>2014-09-26 18:42:39 -0300
commite3e051c42c484ddd924d3230cd51544545986645 (patch)
tree2909aba094341bd29455eeb2d65578e81818df74 /libavfilter/af_join.c
parent7618d360ca0b5c50c9893e45f7b0b3575ee9ccfc (diff)
libavfilter/af_join: avoid derreferencing possible null
ff_all_channel_layouts() might return null on alloc failure. Fixes CID1241518 Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Diffstat (limited to 'libavfilter/af_join.c')
-rw-r--r--libavfilter/af_join.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
index 560c5c82dc..a1717c63b9 100644
--- a/libavfilter/af_join.c
+++ b/libavfilter/af_join.c
@@ -248,9 +248,12 @@ static int join_query_formats(AVFilterContext *ctx)
ff_add_channel_layout(&layouts, s->channel_layout);
ff_channel_layouts_ref(layouts, &ctx->outputs[0]->in_channel_layouts);
- for (i = 0; i < ctx->nb_inputs; i++)
- ff_channel_layouts_ref(ff_all_channel_layouts(),
- &ctx->inputs[i]->out_channel_layouts);
+ for (i = 0; i < ctx->nb_inputs; i++) {
+ layouts = ff_all_channel_layouts();
+ if (!layouts)
+ return AVERROR(ENOMEM);
+ ff_channel_layouts_ref(layouts, &ctx->inputs[i]->out_channel_layouts);
+ }
ff_set_common_formats (ctx, ff_planar_sample_fmts());
ff_set_common_samplerates(ctx, ff_all_samplerates());