svn commit: r192570 - head/usr.sbin/iostat
Xin LI
delphij at FreeBSD.org
Thu May 21 23:00:20 UTC 2009
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
More information about the svn-src-all
mailing list