mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-21 06:20:09 +01:00
tools/opt_common: Check for malloc failure
Fixes: CID1539100 Negative loop bound
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ba7038043a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -722,10 +722,13 @@ int show_codecs(void *optctx, const char *opt, const char *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_codecs(int encoder)
|
static int print_codecs(int encoder)
|
||||||
{
|
{
|
||||||
const AVCodecDescriptor **codecs;
|
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"
|
printf("%s:\n"
|
||||||
" V..... = Video\n"
|
" V..... = Video\n"
|
||||||
@@ -759,18 +762,17 @@ static void print_codecs(int encoder)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
av_free(codecs);
|
av_free(codecs);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int show_decoders(void *optctx, const char *opt, const char *arg)
|
int show_decoders(void *optctx, const char *opt, const char *arg)
|
||||||
{
|
{
|
||||||
print_codecs(0);
|
return print_codecs(0);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int show_encoders(void *optctx, const char *opt, const char *arg)
|
int show_encoders(void *optctx, const char *opt, const char *arg)
|
||||||
{
|
{
|
||||||
print_codecs(1);
|
return print_codecs(1);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int show_bsfs(void *optctx, const char *opt, const char *arg)
|
int show_bsfs(void *optctx, const char *opt, const char *arg)
|
||||||
|
|||||||
Reference in New Issue
Block a user