summaryrefslogtreecommitdiff
path: root/bin/ps
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-01 19:32:20 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-01 19:32:20 +0000
commitb32111f8c12acc73d36d7ce64b0eb6e316f54762 (patch)
tree19db006283ebbbae6eab5322cd14d17a659b2356 /bin/ps
parent8b2d7ba1f3b200ac03db469f8f4535c1103aeb03 (diff)
malloc(n * m) -> calloc(n, m); from zinovik
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/ps.c6
1 files changed, 3 insertions, 3 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];