[FFmpeg-devel] [PATCH 4/5] avfilter/formats: proper error handling in ff_set_common_*() functions

Stefano Sabatini stefasab at gmail.com
Sun Mar 15 15:07:16 CET 2015


On date Sunday 2015-03-15 14:24:29 +0100, Clément Bœsch encoded:
> ---
>  libavfilter/formats.c | 45 ++++++++++++++++++++++++++++++++-------------
>  libavfilter/formats.h | 10 +++++-----
>  2 files changed, 37 insertions(+), 18 deletions(-)
> 
> diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> index 6393416..4f9773b 100644
> --- a/libavfilter/formats.c
> +++ b/libavfilter/formats.c
> @@ -401,7 +401,12 @@ AVFilterChannelLayouts *ff_all_channel_counts(void)
>  }
>  
>  #define FORMATS_REF(f, ref)                                                     \
> -    void *tmp = av_realloc_array(f->refs, sizeof(*f->refs), f->refcount + 1);   \
> +    void *tmp;                                                                  \
> +                                                                                \
> +    if (!ref)                                                                   \
> +        return AVERROR_BUG;                                                     \

I'd prefer to crash or assert here, assuming the function doesn't
assume NULL, same below.

(Unrelated note: "bug" is a silly term, "defect" is more proper - I'm
with Dijkstra here).

[...]

LGTM otherwise, thanks.
-- 
FFmpeg = Fierce Fiendish Magnificient Philosophical Erudite Game


More information about the ffmpeg-devel mailing list