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;
|
buf = NULL;
|
||||||
linecap = 0;
|
linecap = 0;
|
||||||
|
|
||||||
extendarray(&config.groups, &config.numgroups, 200);
|
config.numgroups = 200;
|
||||||
memset(config.groups, 0, config.numgroups * sizeof(char *));
|
config.groups = calloc(config.numgroups, sizeof(char *));
|
||||||
|
if (config.groups == NULL)
|
||||||
|
err(1, "calloc()");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
file = _PATH_PW_CONF;
|
file = _PATH_PW_CONF;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user