summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-09-27 18:31:18 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-09-27 18:31:18 +0000
commitc7cc9c745cb8dec915a0b3e546662a269fcc79a6 (patch)
tree1a9c55692d3b12447f04910cad2aadfba76935d6
parente6a4eea15b611e8635b0803a8a764086910c350b (diff)
Fix another case of inconstitent error handling that was missed in the
previous commit. ok moritz@
-rw-r--r--usr.sbin/tcpdump/privsep_pcap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/tcpdump/privsep_pcap.c b/usr.sbin/tcpdump/privsep_pcap.c
index 4b4071c98b8..7074c58c8e3 100644
--- a/usr.sbin/tcpdump/privsep_pcap.c
+++ b/usr.sbin/tcpdump/privsep_pcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep_pcap.c,v 1.10 2005/09/26 19:30:48 otto Exp $ */
+/* $OpenBSD: privsep_pcap.c,v 1.11 2005/09/27 18:31:17 otto Exp $ */
/*
* Copyright (c) 2004 Can Erkin Acar
@@ -85,13 +85,14 @@ setfilter(int bpfd, int sock, char *filter)
pcap_freecode(&fcode);
goto err;
}
- /* write the filter */
- must_write(sock, &fcode.bf_len, sizeof(fcode.bf_len));
- if (fcode.bf_len > 0)
+ if (fcode.bf_len > 0) {
+ /* write the filter */
+ must_write(sock, &fcode.bf_len, sizeof(fcode.bf_len));
must_write(sock, fcode.bf_insns,
fcode.bf_len * sizeof(struct bpf_insn));
- else {
+ } else {
snprintf(hpcap.errbuf, PCAP_ERRBUF_SIZE, "Invalid filter size");
+ pcap_freecode(&fcode);
goto err;
}