]> The Tcpdump Group git mirrors - libpcap/commit
When attaching a "bpf_program" to a "pcap_t" to use as a userland
authorguy <guy>
Sat, 28 Oct 2000 00:01:26 +0000 (00:01 +0000)
committerguy <guy>
Sat, 28 Oct 2000 00:01:26 +0000 (00:01 +0000)
commit82547471f79c2cf4a9943a222d006edc4add2d76
tree803d1cceed386d4025205dc5ae836cc38d62b6a9
parent188fee53ccbbe6b11e84ae01b10955205be5ac62
When attaching a "bpf_program" to a "pcap_t" to use as a userland
filter, always attach a copy, as "pcap-linux.c" does; that way, after a
program uses "pcap_setfilter()", it can safely use "pcap_freecode()" to
free up the BPF instructions allocated by "pcap_compile()".  Also,
always free it up when the "pcap_t" is closed.

Get rid of the "pcap_t *" argument to "pcap_freecode()", as it's not
necessary.

Document "pcap_freecode()", for the benefit of programs that might
repeatedly compile filter programs and attach them, so that they can
free them up after attaching them and avoid leaking memory for them.
14 files changed:
gencode.c
gencode.h
optimize.c
pcap-bpf.c
pcap-dlpi.c
pcap-linux.c
pcap-nit.c
pcap-null.c
pcap-pf.c
pcap-snit.c
pcap-snoop.c
pcap.3
pcap.c
pcap.h