summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2007-09-01 19:32:19 +0000
committerderaadt <deraadt@openbsd.org>2007-09-01 19:32:19 +0000
commitc72232dbcd0ce248923eb0630db8082bc9509eb7 (patch)
treeb2969ab2eebdf88c3716dc791595b384572e0a1b
parentCorrect the backwards ethernet address that some NVidia MACs have. (diff)
downloadwireguard-openbsd-c72232dbcd0ce248923eb0630db8082bc9509eb7.tar.xz
wireguard-openbsd-c72232dbcd0ce248923eb0630db8082bc9509eb7.zip
malloc(n * m) -> calloc(n, m); from zinovik
-rw-r--r--bin/ps/ps.c6
-rw-r--r--usr.bin/systat/swap.c6
-rw-r--r--usr.bin/systat/vmstat.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index db576ae97cf..87274f1e2da 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ps.c,v 1.42 2006/11/01 19:07:18 jmc Exp $ */
+/* $OpenBSD: ps.c,v 1.43 2007/09/01 19:32:19 deraadt Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: ps.c,v 1.42 2006/11/01 19:07:18 jmc Exp $";
+static char rcsid[] = "$OpenBSD: ps.c,v 1.43 2007/09/01 19:32:19 deraadt Exp $";
#endif
#endif /* not lint */
@@ -361,7 +361,7 @@ main(int argc, char *argv[])
* sort proc list, we convert from an array of structs to an array
* of pointers to make the sort cheaper.
*/
- if ((kinfo = malloc(sizeof(*kinfo) * nentries)) == NULL)
+ if ((kinfo = calloc(sizeof(*kinfo), nentries)) == NULL)
err(1, "failed to allocate memory for proc pointers");
for (i = 0; i < nentries; i++)
kinfo[i] = &kp[i];
diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c
index 619a6d21721..84e55190b2b 100644
--- a/usr.bin/systat/swap.c
+++ b/usr.bin/systat/swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: swap.c,v 1.19 2007/02/25 18:21:24 deraadt Exp $ */
+/* $OpenBSD: swap.c,v 1.20 2007/09/01 19:32:19 deraadt Exp $ */
/* $NetBSD: swap.c,v 1.9 1998/12/26 07:05:08 marc Exp $ */
/*-
@@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)swap.c 8.3 (Berkeley) 4/29/95";
#endif
-static char rcsid[] = "$OpenBSD: swap.c,v 1.19 2007/02/25 18:21:24 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: swap.c,v 1.20 2007/09/01 19:32:19 deraadt Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
@@ -98,7 +98,7 @@ fetchswap(void)
if (swap_devices)
(void)free(swap_devices);
- swap_devices = (struct swapent *)malloc(nswap * sizeof(*swap_devices));
+ swap_devices = (struct swapent *)calloc(nswap, sizeof(*swap_devices));
if (swap_devices == NULL)
/* XXX */ ; /* XXX systat doesn't do errors! */
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index bb33c675698..c79b7c7f5ac 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmstat.c,v 1.62 2007/02/25 18:21:24 deraadt Exp $ */
+/* $OpenBSD: vmstat.c,v 1.63 2007/09/01 19:32:19 deraadt Exp $ */
/* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
#endif
-static char rcsid[] = "$OpenBSD: vmstat.c,v 1.62 2007/02/25 18:21:24 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: vmstat.c,v 1.63 2007/09/01 19:32:19 deraadt Exp $";
#endif /* not lint */
/*
@@ -604,7 +604,7 @@ static void
allocinfo(struct Info *s)
{
- s->intrcnt = (u_quad_t *) malloc(nintr * sizeof(u_quad_t));
+ s->intrcnt = (u_quad_t *) calloc(nintr, sizeof(u_quad_t));
if (s->intrcnt == NULL)
errx(2, "out of memory");
}