[FFmpeg-devel] [PATCHv2 1/2] avfilter/all: propagate errors of functions from avfilter/formats

Clément Bœsch u at pkh.me
Sat Oct 10 15:40:45 CEST 2015


On Sat, Oct 10, 2015 at 09:34:21AM -0400, Ganesh Ajjanagadde wrote:
[...]
> diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c
> index 314746d..0e31ef7 100644
> --- a/libavfilter/vsrc_life.c
> +++ b/libavfilter/vsrc_life.c
> @@ -417,6 +417,7 @@ static int query_formats(AVFilterContext *ctx)
>      LifeContext *life = ctx->priv;
>      enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_NONE, AV_PIX_FMT_NONE };
>      AVFilterFormats *fmts_list;
> +    int ret;
>  
>      if (life->mold || memcmp(life-> life_color, "\xff\xff\xff", 3)
>                     || memcmp(life->death_color, "\x00\x00\x00", 3)) {
> @@ -428,10 +429,7 @@ static int query_formats(AVFilterContext *ctx)
>      }
>  
>      fmts_list = ff_make_format_list(pix_fmts);
> -    if (!fmts_list)
> -        return AVERROR(ENOMEM);
> -    ff_set_common_formats(ctx, fmts_list);
> -    return 0;
> +    return ff_set_common_formats(ctx, fmts_list);

if ff_make_format_list() fails, fmts_list will be NULL and
ff_set_common_formats() will return AVERROR_BUG instead of AVERROR(ENOMEM)

You could change that last function to return AVERROR(ENOMEM) in case a
parameter is NULL, but that's weird semantic.

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151010/2dff2c0e/attachment.sig>


More information about the ffmpeg-devel mailing list