summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2006-04-03 01:31:12 +0000
committerDamien Miller <djm@cvs.openbsd.org>2006-04-03 01:31:12 +0000
commite18f913a64d2f5ecd13ffdfd8add7ca9bbb93e94 (patch)
tree062e820797b1dc01d497d48f824767b3143fb530 /usr.bin
parent3528f180d3ebcd8412d900eea8a18ca2e4f799aa (diff)
some more malloc(x * y); bzero() -> calloc(x, y) whacking from
adobriyan AT gmail.com
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tr/str.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/tr/str.c b/usr.bin/tr/str.c
index 4f9393815ce..1b36e39bf2d 100644
--- a/usr.bin/tr/str.c
+++ b/usr.bin/tr/str.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: str.c,v 1.9 2004/09/15 22:12:19 deraadt Exp $ */
+/* $OpenBSD: str.c,v 1.10 2006/04/03 01:31:11 djm Exp $ */
/* $NetBSD: str.c,v 1.7 1995/08/31 22:13:47 jtc Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)str.c 8.2 (Berkeley) 4/28/95";
#endif
-static char rcsid[] = "$OpenBSD: str.c,v 1.9 2004/09/15 22:12:19 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: str.c,v 1.10 2006/04/03 01:31:11 djm Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
@@ -183,9 +183,8 @@ genclass(s)
sizeof(CLASS), sizeof(CLASS), c_class)) == NULL)
errx(1, "unknown class %s", s->str);
- if ((cp->set = p = malloc((NCHARS + 1) * sizeof(int))) == NULL)
+ if ((cp->set = p = calloc(NCHARS + 1, sizeof(int))) == NULL)
errx(1, "no memory for a class");
- bzero(p, (NCHARS + 1) * sizeof(int));
for (cnt = 0, func = cp->func; cnt < NCHARS; ++cnt)
if ((func)(cnt))
*p++ = cnt;