summaryrefslogtreecommitdiff
path: root/bin/ps
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-05-07 01:31:26 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-05-07 01:31:26 +0000
commitcb2ca95f432529c676ea46d485cb8d0ed8333028 (patch)
treed96e1a441015c0916634cad2755fb4150acbf0c9 /bin/ps
parent6de9fac967ede5635a6815faa7c08e751b033f57 (diff)
convert calloc to use reallocarray instead. ok millert
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/ps.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 539fc153dc1..608ddd78804 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ps.c,v 1.59 2013/11/21 15:54:45 deraadt Exp $ */
+/* $OpenBSD: ps.c,v 1.60 2014/05/07 01:31:25 tedu Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
@@ -332,7 +332,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 = calloc(sizeof(*kinfo), nentries)) == NULL)
+ if ((kinfo = reallocarray(NULL, nentries, sizeof(*kinfo))) == NULL)
err(1, "failed to allocate memory for proc pointers");
for (i = 0; i < nentries; i++)
kinfo[i] = &kp[i];