diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-11-04 07:37:21 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-11-09 11:25:17 +0100 |
commit | ed0a50923a8fb36ff6535f5a87bfede41f6fac0e (patch) | |
tree | a6ef5bfc0457a124f5eb06ae2f13d3f9a0af0a17 | |
parent | e900a559c25251398e6d0e0268ef836771fbec06 (diff) | |
download | ffmpeg-ed0a50923a8fb36ff6535f5a87bfede41f6fac0e.tar.gz |
fftools/cmdutils: only set array size after allocation succeeded
-rw-r--r-- | fftools/cmdutils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 156c13801a..86cd3bddb4 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -665,10 +665,10 @@ static int init_parse_context(OptionParseContext *octx, memset(octx, 0, sizeof(*octx)); - octx->nb_groups = nb_groups; - octx->groups = av_calloc(octx->nb_groups, sizeof(*octx->groups)); + octx->groups = av_calloc(nb_groups, sizeof(*octx->groups)); if (!octx->groups) return AVERROR(ENOMEM); + octx->nb_groups = nb_groups; for (i = 0; i < octx->nb_groups; i++) octx->groups[i].group_def = &groups[i]; |