diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2006-04-02 21:38:58 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2006-04-02 21:38:58 +0000 |
commit | 5b14fea36497511e6428b2c588513d92bc92cb90 (patch) | |
tree | 0b66759932d131cfb42148e0672334d215e6b99f /usr.bin/apropos/apropos.c | |
parent | ba37f6b6fd488dbe7dd7be429e8b7a994a783155 (diff) |
malloc(x * y) -> calloc(x, y) from adobriyan AT gmail.com, with tweaks
suggested by kjell@; ok otto@ pat@ millert@ jaredy@
Diffstat (limited to 'usr.bin/apropos/apropos.c')
-rw-r--r-- | usr.bin/apropos/apropos.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/apropos/apropos.c b/usr.bin/apropos/apropos.c index d680b7e44bc..86b8903adbe 100644 --- a/usr.bin/apropos/apropos.c +++ b/usr.bin/apropos/apropos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apropos.c,v 1.11 2005/10/17 19:04:19 otto Exp $ */ +/* $OpenBSD: apropos.c,v 1.12 2006/04/02 21:38:56 djm Exp $ */ /* $NetBSD: apropos.c,v 1.5 1995/09/04 20:46:20 tls Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)apropos.c 8.8 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: apropos.c,v 1.11 2005/10/17 19:04:19 otto Exp $"; +static char rcsid[] = "$OpenBSD: apropos.c,v 1.12 2006/04/02 21:38:56 djm Exp $"; #endif #endif /* not lint */ @@ -99,9 +99,8 @@ main(int argc, char *argv[]) if (argc < 1) usage(); - if ((found = malloc((u_int)argc * sizeof(int))) == NULL) + if ((found = calloc(argc, sizeof(int))) == NULL) err(1, NULL); - memset(found, 0, argc * sizeof(int)); for (p = argv; *p; ++p) /* convert to lower-case */ lowstr(*p, *p); |