svn commit: r282720 - head/usr.sbin/pw
Baptiste Daroussin
bapt at FreeBSD.org
Sun May 10 11:18:02 UTC 2015
Author: bapt
Date: Sun May 10 11:18:01 2015
New Revision: 282720
URL: https://svnweb.freebsd.org/changeset/base/282720
Log:
Use calloc(3) instead of malloc(3) + memset(3)
While here check the return of calloc(3)
Modified:
head/usr.sbin/pw/pw_conf.c
Modified: head/usr.sbin/pw/pw_conf.c
==============================================================================
--- head/usr.sbin/pw/pw_conf.c Sun May 10 10:15:36 2015 (r282719)
+++ head/usr.sbin/pw/pw_conf.c Sun May 10 11:18:01 2015 (r282720)
@@ -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;
More information about the svn-src-head
mailing list