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 <bianpan2...@163.com> --- libavfilter/avf_ahistogram.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavfilter/avf_ahistogram.c b/libavfilter/avf_ahistogram.c index 5874151..1b779da 100644 --- a/libavfilter/avf_ahistogram.c +++ b/libavfilter/avf_ahistogram.c @@ -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(); -- 1.9.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel