svn commit: r279156 - head/usr.sbin/pmccontrol

Pedro F. Giffuni pfg at FreeBSD.org
Sun Feb 22 14:45:01 UTC 2015


Author: pfg
Date: Sun Feb 22 14:45:00 2015
New Revision: 279156
URL: https://svnweb.freebsd.org/changeset/base/279156

Log:
  pmccontrol(8): Replace malloc() + memset() with calloc()
  
  PMCC_OP_IGNORE happens to be zero, so just use calloc() here.

Modified:
  head/usr.sbin/pmccontrol/pmccontrol.c

Modified: head/usr.sbin/pmccontrol/pmccontrol.c
==============================================================================
--- head/usr.sbin/pmccontrol/pmccontrol.c	Sun Feb 22 14:03:40 2015	(r279155)
+++ head/usr.sbin/pmccontrol/pmccontrol.c	Sun Feb 22 14:45:00 2015	(r279156)
@@ -147,11 +147,9 @@ pmcc_do_enable_disable(struct pmcc_op_li
 	if (npmc == 0)
 		errx(EX_CONFIG, "No PMCs found");
 
-	if ((map = malloc(npmc * ncpu)) == NULL)
+	if ((map = calloc(npmc, ncpu)) == NULL)
 		err(EX_SOFTWARE, "Out of memory");
 
-	(void) memset(map, PMCC_OP_IGNORE, npmc*ncpu);
-
 	error = 0;
 	STAILQ_FOREACH(np, op_list, op_next) {
 


More information about the svn-src-all mailing list