Date: Sun, 22 Feb 2015 14:45:00 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279156 - head/usr.sbin/pmccontrol Message-ID: <201502221445.t1MEj0kQ075626@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502221445.t1MEj0kQ075626>