Minor fixes for possible leaks on uncommon code path or on initialization.

This commit is contained in:
Gregor Maier 2011-08-23 20:28:11 -07:00
parent 4214d8d905
commit f3a92ec30b
2 changed files with 10 additions and 1 deletions

View file

@ -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;
}

View file

@ -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))
{