summaryrefslogtreecommitdiff
path: root/usr.sbin/route6d/route6d.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2006-04-02 21:38:58 +0000
committerDamien Miller <djm@cvs.openbsd.org>2006-04-02 21:38:58 +0000
commit5b14fea36497511e6428b2c588513d92bc92cb90 (patch)
tree0b66759932d131cfb42148e0672334d215e6b99f /usr.sbin/route6d/route6d.c
parentba37f6b6fd488dbe7dd7be429e8b7a994a783155 (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.sbin/route6d/route6d.c')
-rw-r--r--usr.sbin/route6d/route6d.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index 1c4c389b663..ad0ee22f25f 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route6d.c,v 1.43 2006/02/06 17:51:30 jmc Exp $ */
+/* $OpenBSD: route6d.c,v 1.44 2006/04/02 21:38:55 djm Exp $ */
/* $KAME: route6d.c,v 1.94 2002/10/26 20:08:55 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#if 0
-static char _rcsid[] = "$OpenBSD: route6d.c,v 1.43 2006/02/06 17:51:30 jmc Exp $";
+static char _rcsid[] = "$OpenBSD: route6d.c,v 1.44 2006/04/02 21:38:55 djm Exp $";
#endif
#include <stdio.h>
@@ -3409,13 +3409,11 @@ setindex2ifc(int idx, struct ifc *ifcp)
if (!index2ifc) {
nindex2ifc = 5; /*initial guess*/
- index2ifc = (struct ifc **)
- malloc(sizeof(*index2ifc) * nindex2ifc);
+ index2ifc = calloc(nindex2ifc, sizeof(*index2ifc));
if (index2ifc == NULL) {
- fatal("malloc");
+ fatal("calloc");
/*NOTREACHED*/
}
- memset(index2ifc, 0, sizeof(*index2ifc) * nindex2ifc);
}
n = nindex2ifc;
while (nindex2ifc <= idx)