aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-05-10 11:18:01 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-05-10 11:18:01 +0000
commita1d3bf2e8f8bd4ec35ddc3befb11c9df9c204e9d (patch)
tree9c4f5f43c400e303cb50c6a52149b000f67d4adc
parent36dc2e68859cd2abbc2c3cb42ddc71c921dc3a2d (diff)
downloadsrc-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.c6
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;