diff --git a/src/Sessions.cc b/src/Sessions.cc index b6e19f4cf4..382bd9c5b3 100644 --- a/src/Sessions.cc +++ b/src/Sessions.cc @@ -444,6 +444,8 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr, proto != IPPROTO_ICMP ) { dump_this_packet = 1; + if ( f ) + Remove(t); delete_tunnel_info(tunnel_info); return; } @@ -516,6 +518,8 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr, default: Weird(fmt("unknown_protocol %d", proto), hdr, pkt); + if ( f ) + Remove(f); delete_tunnel_info(tunnel_info); return; } @@ -546,6 +550,8 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr, if ( consistent < 0 ) { delete h; + if ( f ) + Remove(f); delete_tunnel_info(tunnel_info); return; } @@ -571,6 +577,8 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr, if ( ! conn ) { delete_tunnel_info(tunnel_info); + if ( f ) + Remove(f); return; } diff --git a/src/TunnelHandler.cc b/src/TunnelHandler.cc index a5ee9cae3c..a7fbd4ce29 100644 --- a/src/TunnelHandler.cc +++ b/src/TunnelHandler.cc @@ -24,7 +24,8 @@ TunnelHandler::TunnelHandler(NetSessions *arg_s) // lookup. for (int i=0; i< 65536; i++) { - Unref(pv); + if (pv) + Unref(pv); pv = new PortVal(i, TRANSPORT_UDP); if (udp_tunnel_ports->Lookup(pv, false)) {