From 321f45d8e81dd2b0ab127ad12a928d3bb2b52766 Mon Sep 17 00:00:00 2001 From: pfg Date: Sun, 22 Feb 2015 14:45:00 +0000 Subject: pmccontrol(8): Replace malloc() + memset() with calloc() PMCC_OP_IGNORE happens to be zero, so just use calloc() here. --- usr.sbin/pmccontrol/pmccontrol.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'usr.sbin/pmccontrol') diff --git a/usr.sbin/pmccontrol/pmccontrol.c b/usr.sbin/pmccontrol/pmccontrol.c index b3585d0..c1e2acd 100644 --- a/usr.sbin/pmccontrol/pmccontrol.c +++ b/usr.sbin/pmccontrol/pmccontrol.c @@ -147,11 +147,9 @@ pmcc_do_enable_disable(struct pmcc_op_list *op_list) 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) { -- cgit v1.1