[FFmpeg-devel] [PATCHv2 1/2] avfilter/all: propagate errors of functions from avfilter/formats
Ganesh Ajjanagadde
gajjanag at mit.edu
Sat Oct 10 15:47:17 CEST 2015
On Sat, Oct 10, 2015 at 9:40 AM, Clément Bœsch <u at pkh.me> wrote:
> 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.
Good catch, I missed some AVERROR_BUG stuff. Updated locally, will
send out new one once more comments roll in. The semantics might be
slightly weird, but I thought this was what Nicolas had in mind: it is
ok since it improves the readability of this patch.
>
> [...]
>
> --
> Clément B.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list