Use calloc(3) instead of malloc(3) + memset(3)
While here check the return of calloc(3)
This commit is contained in:
parent
7b3f5d741e
commit
6097f34be5
@ -234,8 +234,10 @@ read_userconfig(char const * file)
|
||||
buf = NULL;
|
||||
linecap = 0;
|
||||
|
||||
extendarray(&config.groups, &config.numgroups, 200);
|
||||
memset(config.groups, 0, config.numgroups * sizeof(char *));
|
||||
config.numgroups = 200;
|
||||
config.groups = calloc(config.numgroups, sizeof(char *));
|
||||
if (config.groups == NULL)
|
||||
err(1, "calloc()");
|
||||
if (file == NULL)
|
||||
file = _PATH_PW_CONF;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user