summaryrefslogtreecommitdiff
path: root/lib/libpcap
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 /lib/libpcap
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 'lib/libpcap')
-rw-r--r--lib/libpcap/optimize.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libpcap/optimize.c b/lib/libpcap/optimize.c
index 48fc0dc6e94..3c5fa1eb795 100644
--- a/lib/libpcap/optimize.c
+++ b/lib/libpcap/optimize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: optimize.c,v 1.11 2005/11/19 01:51:11 aaron Exp $ */
+/* $OpenBSD: optimize.c,v 1.12 2006/04/02 21:38:57 djm Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996
@@ -1922,7 +1922,7 @@ convert_code_r(p)
/* generate offset[] for convenience */
if (slen) {
- offset = (struct slist **)calloc(slen, sizeof(struct slist *));
+ offset = calloc(slen, sizeof(struct slist *));
if (!offset) {
bpf_error("not enough core");
/*NOTREACHED*/
@@ -2069,11 +2069,10 @@ icode_to_fcode(root, lenp)
unMarkAll();
n = *lenp = count_stmts(root);
- fp = (struct bpf_insn *)malloc(sizeof(*fp) * n);
+ fp = calloc(n, sizeof(*fp));
if (fp == NULL)
- bpf_error("malloc");
+ bpf_error("calloc");
- memset((char *)fp, 0, sizeof(*fp) * n);
fstart = fp;
ftail = fp + n;