diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-05-10 11:18:01 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-05-10 11:18:01 +0000 |
commit | a1d3bf2e8f8bd4ec35ddc3befb11c9df9c204e9d (patch) | |
tree | 9c4f5f43c400e303cb50c6a52149b000f67d4adc | |
parent | 36dc2e68859cd2abbc2c3cb42ddc71c921dc3a2d (diff) | |
download | src-a1d3bf2e8f8bd4ec35ddc3befb11c9df9c204e9d.tar.gz src-a1d3bf2e8f8bd4ec35ddc3befb11c9df9c204e9d.zip |
Use calloc(3) instead of malloc(3) + memset(3)
While here check the return of calloc(3)
Notes
Notes:
svn path=/head/; revision=282720
-rw-r--r-- | usr.sbin/pw/pw_conf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/pw/pw_conf.c b/usr.sbin/pw/pw_conf.c index e988f4bdf121..99d3e8fdbec1 100644 --- a/usr.sbin/pw/pw_conf.c +++ b/usr.sbin/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; |