diff options
author | 2015-05-10 11:18:01 +0000 | |
---|---|---|
committer | 2015-05-10 11:18:01 +0000 | |
commit | c9b35173704bf9aaebcf62d0915543b81e9ee8d3 (patch) | |
tree | 6c98f67770bfed6006704afa2f271b2700004dc0 /pw/pw_conf.c | |
parent | 97f18faf798474452fd15880e7e8c81d786465e7 (diff) | |
download | pw-darwin-c9b35173704bf9aaebcf62d0915543b81e9ee8d3.tar.gz pw-darwin-c9b35173704bf9aaebcf62d0915543b81e9ee8d3.tar.zst pw-darwin-c9b35173704bf9aaebcf62d0915543b81e9ee8d3.zip |
Use calloc(3) instead of malloc(3) + memset(3)
While here check the return of calloc(3)
Diffstat (limited to 'pw/pw_conf.c')
-rw-r--r-- | pw/pw_conf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pw/pw_conf.c b/pw/pw_conf.c index e988f4b..99d3e8f 100644 --- a/pw/pw_conf.c +++ b/pw/pw_conf.c @@ -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; |