@@ -97,9 +97,11 @@ static int query_formats(AVFilterContext *ctx)
int ret = AVERROR(EINVAL);
formats = ff_make_format_list(sample_fmts);
- if ((ret = ff_formats_ref (formats, &inlink->out_formats )) < 0 ||
- (layouts = ff_all_channel_counts()) == NULL ||
- (ret = ff_channel_layouts_ref (layouts, &inlink->out_channel_layouts)) < 0)
+ if ((ret = ff_formats_ref(formats, &inlink->out_formats)) < 0)
+ return ret;
+ if (!(layouts = ff_all_channel_counts()))
+ return AVERROR(ENOMEM);
+ if ((ret = ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts)) < 0)
return ret;
formats = ff_all_samplerates();
In function query_formats(), it incorrectly returns 0 when the function ff_all_channel_counts() returns a NULL pointer (the check of variable ret before the NULL check guarantees that the return value is not negative). Signed-off-by: Pan Bian <bianpan2016@163.com> --- libavfilter/avf_ahistogram.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)