diff options
author | 2014-03-14 03:44:13 +0000 | |
---|---|---|
committer | 2014-03-14 03:44:13 +0000 | |
commit | 8d365cd491fb84475ed1d9f04dd021b27ddcc513 (patch) | |
tree | 1fe9863c0d06bebd4ded55402aa310041a59b8d9 /lib/libpcap/gencode.c | |
parent | rework mplocks to use tickets instead of spinning. this provides (diff) | |
download | wireguard-openbsd-8d365cd491fb84475ed1d9f04dd021b27ddcc513.tar.xz wireguard-openbsd-8d365cd491fb84475ed1d9f04dd021b27ddcc513.zip |
Change a few malloc+memset calls to calloc.
ok deraadt@ florian@
Diffstat (limited to 'lib/libpcap/gencode.c')
-rw-r--r-- | lib/libpcap/gencode.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c index 5d77801b279..2b62858ba44 100644 --- a/lib/libpcap/gencode.c +++ b/lib/libpcap/gencode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gencode.c,v 1.36 2010/10/09 08:14:36 canacar Exp $ */ +/* $OpenBSD: gencode.c,v 1.37 2014/03/14 03:44:13 lteo Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 @@ -191,11 +191,10 @@ newchunk(n) if (k >= NCHUNKS) bpf_error("out of memory"); size = CHUNK0SIZE << k; - cp->m = (void *)malloc(size); + cp->m = (void *)calloc(1, size); if (cp->m == NULL) bpf_error("out of memory"); - - memset((char *)cp->m, 0, size); + cp->n_left = size; if (n > size) bpf_error("out of memory"); |