libavfilter/af_channelmap: avoid derreferencing possible null

ff_all_channel_layouts() might return null on alloc failure.

Fixes CID1241517
Signed-off-by: 's avatarReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
parent e3e051c4
......@@ -287,10 +287,16 @@ static av_cold int channelmap_init(AVFilterContext *ctx)
static int channelmap_query_formats(AVFilterContext *ctx)
{
ChannelMapContext *s = ctx->priv;
AVFilterChannelLayouts *layouts;
ff_set_common_formats(ctx, ff_planar_sample_fmts());
ff_set_common_samplerates(ctx, ff_all_samplerates());
ff_channel_layouts_ref(ff_all_channel_layouts(), &ctx->inputs[0]->out_channel_layouts);
layouts = ff_all_channel_layouts();
if (!layouts)
return AVERROR(ENOMEM);
ff_channel_layouts_ref(layouts, &ctx->inputs[0]->out_channel_layouts);
ff_channel_layouts_ref(s->channel_layouts, &ctx->outputs[0]->in_channel_layouts);
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment