From owner-svn-src-head@FreeBSD.ORG Thu May 21 23:00:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EF751065672; Thu, 21 May 2009 23:00:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C8058FC1B; Thu, 21 May 2009 23:00:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4LN0KE8087012; Thu, 21 May 2009 23:00:20 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4LN0KWR087011; Thu, 21 May 2009 23:00:20 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200905212300.n4LN0KWR087011@svn.freebsd.org> From: Xin LI Date: Thu, 21 May 2009 23:00:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192570 - head/usr.sbin/iostat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2009 23:00:20 -0000 Author: delphij Date: Thu May 21 23:00:20 2009 New Revision: 192570 URL: http://svn.freebsd.org/changeset/base/192570 Log: Use calloc(). Modified: head/usr.sbin/iostat/iostat.c Modified: head/usr.sbin/iostat/iostat.c ============================================================================== --- head/usr.sbin/iostat/iostat.c Thu May 21 22:12:42 2009 (r192569) +++ head/usr.sbin/iostat/iostat.c Thu May 21 23:00:20 2009 (r192570) @@ -311,16 +311,13 @@ main(int argc, char **argv) } } - cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); + cur.dinfo = (struct devinfo *)calloc(1, sizeof(struct devinfo)); if (cur.dinfo == NULL) - err(1, "malloc failed"); + err(1, "calloc failed"); - last.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); + last.dinfo = (struct devinfo *)calloc(1, sizeof(struct devinfo)); if (last.dinfo == NULL) - err(1, "malloc failed"); - - bzero(cur.dinfo, sizeof(struct devinfo)); - bzero(last.dinfo, sizeof(struct devinfo)); + err(1, "calloc failed"); /* * Grab all the devices. We don't look to see if the list has