Message ID | 20240428213052.3800493-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | ba7038043a46420bc86b060dbb13b956ea50ac03 |
Headers | show |
Series | [FFmpeg-devel,1/5] tools/opt_common: Check for malloc failure | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
On Sun, Apr 28, 2024 at 11:30:48PM +0200, Michael Niedermayer wrote: > Fixes: CID1539100 Negative loop bound > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > fftools/opt_common.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) will apply [...]
diff --git a/fftools/opt_common.c b/fftools/opt_common.c index 947a226d8d1..9d2d5184a08 100644 --- a/fftools/opt_common.c +++ b/fftools/opt_common.c @@ -724,10 +724,13 @@ int show_codecs(void *optctx, const char *opt, const char *arg) return 0; } -static void print_codecs(int encoder) +static int print_codecs(int encoder) { const AVCodecDescriptor **codecs; - unsigned i, nb_codecs = get_codecs_sorted(&codecs); + int i, nb_codecs = get_codecs_sorted(&codecs); + + if (nb_codecs < 0) + return nb_codecs; printf("%s:\n" " V..... = Video\n" @@ -762,18 +765,17 @@ static void print_codecs(int encoder) } } av_free(codecs); + return 0; } int show_decoders(void *optctx, const char *opt, const char *arg) { - print_codecs(0); - return 0; + return print_codecs(0); } int show_encoders(void *optctx, const char *opt, const char *arg) { - print_codecs(1); - return 0; + return print_codecs(1); } int show_bsfs(void *optctx, const char *opt, const char *arg)
Fixes: CID1539100 Negative loop bound Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- fftools/opt_common.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)