diff options
author | 2006-04-02 21:38:55 +0000 | |
---|---|---|
committer | 2006-04-02 21:38:55 +0000 | |
commit | ad4287e4204c02b0e79cb4b7bbcb41e8bc21ac49 (patch) | |
tree | f8d1e648b70424b1586a748392751de1ee7a0269 /lib/libpcap/optimize.c | |
parent | some characters are in fact allowed in symbol names, don't freak (diff) | |
download | wireguard-openbsd-ad4287e4204c02b0e79cb4b7bbcb41e8bc21ac49.tar.xz wireguard-openbsd-ad4287e4204c02b0e79cb4b7bbcb41e8bc21ac49.zip |
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/optimize.c')
-rw-r--r-- | lib/libpcap/optimize.c | 9 |
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; |