mirror of https://git.ffmpeg.org/ffmpeg.git
fftools/cmdutils: only set array size after allocation succeeded
This commit is contained in:
parent
e900a559c2
commit
ed0a50923a
|
@ -665,10 +665,10 @@ static int init_parse_context(OptionParseContext *octx,
|
||||||
|
|
||||||
memset(octx, 0, sizeof(*octx));
|
memset(octx, 0, sizeof(*octx));
|
||||||
|
|
||||||
octx->nb_groups = nb_groups;
|
octx->groups = av_calloc(nb_groups, sizeof(*octx->groups));
|
||||||
octx->groups = av_calloc(octx->nb_groups, sizeof(*octx->groups));
|
|
||||||
if (!octx->groups)
|
if (!octx->groups)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
octx->nb_groups = nb_groups;
|
||||||
|
|
||||||
for (i = 0; i < octx->nb_groups; i++)
|
for (i = 0; i < octx->nb_groups; i++)
|
||||||
octx->groups[i].group_def = &groups[i];
|
octx->groups[i].group_def = &groups[i];
|
||||||
|
|
Loading…
Reference in New Issue