X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Faf_channelmap.c;h=dcae2a21d9a81e0ba1780099b3e574c0b3e3f6fd;hb=89bbf01978194ee1354bb3feef139a648bc1903b;hp=9e95a98d00a60e24452f43f43eb31aeaa3287187;hpb=5c0dbc20fceb04ffd129983ba6717230137efec5;p=ffmpeg diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index 9e95a98d00a..dcae2a21d9a 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -292,14 +292,23 @@ static int channelmap_query_formats(AVFilterContext *ctx) int ret; layouts = ff_all_channel_layouts(); + if (!layouts) { + ret = AVERROR(ENOMEM); + goto fail; + } if ((ret = ff_add_channel_layout (&channel_layouts, s->output_layout )) < 0 || (ret = ff_set_common_formats (ctx , ff_planar_sample_fmts() )) < 0 || (ret = ff_set_common_samplerates (ctx , ff_all_samplerates() )) < 0 || (ret = ff_channel_layouts_ref (layouts , &ctx->inputs[0]->out_channel_layouts)) < 0 || (ret = ff_channel_layouts_ref (channel_layouts , &ctx->outputs[0]->in_channel_layouts)) < 0) - return ret; + goto fail; return 0; +fail: + if (layouts) + av_freep(&layouts->channel_layouts); + av_freep(&layouts); + return ret; } static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf)