From owner-svn-src-all@FreeBSD.ORG Sun Feb 22 14:45:01 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1306A2E2; Sun, 22 Feb 2015 14:45:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2D93AC9; Sun, 22 Feb 2015 14:45:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1MEj0Nb075628; Sun, 22 Feb 2015 14:45:00 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1MEj0kQ075626; Sun, 22 Feb 2015 14:45:00 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201502221445.t1MEj0kQ075626@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 22 Feb 2015 14:45:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279156 - head/usr.sbin/pmccontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Feb 2015 14:45:01 -0000 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) {