summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-04-29 14:40:45 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-04-29 14:40:45 +0000
commit4f070211ea962ebd5c9ecaf03d5a5b7a55a004e9 (patch)
tree3196f95bbfd9d8fa378a981067a9fcaa8d4e86fe /usr.bin
parent3e1082f7dcda01d092d4b04596d30e353e592f1d (diff)
use calloc(3) instead of malloc(3) to allocate cpu state structs; it's
better style here; plus it prevents bogus data to show up on first display. report + ok pedro@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/top/machine.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index 2e09df9bf5c..697de570ee4 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machine.c,v 1.51 2005/12/21 01:40:24 millert Exp $ */
+/* $OpenBSD: machine.c,v 1.52 2006/04/29 14:40:44 otto Exp $ */
/*-
* Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>
@@ -177,9 +177,9 @@ machine_init(struct statics *statics)
if (cp_time == NULL || cp_old == NULL || cp_diff == NULL)
err(1, NULL);
for (cpu = 0; cpu < ncpu; cpu++) {
- cp_time[cpu] = malloc(CPUSTATES * sizeof(int64_t));
- cp_old[cpu] = malloc(CPUSTATES * sizeof(int64_t));
- cp_diff[cpu] = malloc(CPUSTATES * sizeof(int64_t));
+ cp_time[cpu] = calloc(CPUSTATES, sizeof(int64_t));
+ cp_old[cpu] = calloc(CPUSTATES, sizeof(int64_t));
+ cp_diff[cpu] = calloc(CPUSTATES, sizeof(int64_t));
if (cp_time[cpu] == NULL || cp_old[cpu] == NULL ||
cp_diff[cpu] == NULL)
err(1, NULL);