[FFmpeg-devel] [PATCH 1/2] libavfilter/af_join: avoid derreferencing possible null
Reynaldo H. Verdejo Pinochet
reynaldo at osg.samsung.com
Fri Sep 26 21:19:02 CEST 2014
ff_all_channel_layouts() might return null on alloc failure.
Fixes CID1241518
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com>
---
libavfilter/af_join.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
index 560c5c8..a1717c6 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());
--
2.1.0
More information about the ffmpeg-devel
mailing list