diff options
author | 2015-05-10 11:18:01 +0000 | |
---|---|---|
committer | 2015-05-10 11:18:01 +0000 | |
commit | 8aa579e00eb2cffda16e2948aada76ed913dc387 (patch) | |
tree | 0eeaf69d74ea0c25588e82a75cada76509addc74 /pw | |
parent | 53c8f1f32d75577a289f6062e2db339e7167657f (diff) | |
download | pw-darwin-8aa579e00eb2cffda16e2948aada76ed913dc387.tar.gz pw-darwin-8aa579e00eb2cffda16e2948aada76ed913dc387.tar.zst pw-darwin-8aa579e00eb2cffda16e2948aada76ed913dc387.zip |
Use calloc(3) instead of malloc(3) + memset(3)
While here check the return of calloc(3)
Diffstat (limited to 'pw')
-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; |