Date: Sun, 10 May 2015 11:18:01 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282720 - head/usr.sbin/pw Message-ID: <201505101118.t4ABI1d3066117@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505101118.t4ABI1d3066117>