diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-08 04:52:55 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-08 04:52:55 +0000 |
commit | 103101f9ab8cb10c26f3c0425818957529f3dd8d (patch) | |
tree | c4dc7d32c4bdc936080aa07178256bded2a8cbae /usr.sbin/pstat | |
parent | 2cd504edcf8730df2ceec37c05d9907636337506 (diff) |
use reallocarray(NULL, a, b) instead of malloc(a*b)
ok doug
Diffstat (limited to 'usr.sbin/pstat')
-rw-r--r-- | usr.sbin/pstat/pstat.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index da0f23315de..6e860bbb6fd 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pstat.c,v 1.91 2014/08/20 11:23:42 mikeb Exp $ */ +/* $OpenBSD: pstat.c,v 1.92 2014/10/08 04:52:54 deraadt Exp $ */ /* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */ /*- @@ -897,9 +897,9 @@ ttymode(void) mib[0] = CTL_KERN; mib[1] = KERN_TTY; mib[2] = KERN_TTY_INFO; - nlen = ntty * sizeof(struct itty); - if ((itp = malloc(nlen)) == NULL) + if ((itp = reallocarray(NULL, ntty, sizeof(struct itty))) == NULL) err(1, "malloc"); + nlen = ntty * sizeof(struct itty); if (sysctl(mib, 3, itp, &nlen, NULL, 0) < 0) err(1, "sysctl(KERN_TTY_INFO) failed"); for (i = 0; i < ntty; i++) |