[FFmpeg-devel] avfilter/avf_ahistogram: return correct error code
Pan Bian
bianpan2016 at 163.com
Mon Nov 27 04:22:47 EET 2017
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 at 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
More information about the ffmpeg-devel
mailing list