mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Fixing memleak in tunnel code.
This commit is contained in:
parent
08dc84a250
commit
4214d8d905
1 changed files with 14 additions and 0 deletions
|
@ -355,6 +355,12 @@ static bool looks_like_IPv4_packet(int len, const struct ip* ip_hdr)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void delete_tunnel_info(TunnelInfo *ti)
|
||||||
|
{
|
||||||
|
if ( ti )
|
||||||
|
delete ti;
|
||||||
|
}
|
||||||
|
|
||||||
void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
|
void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
|
||||||
const IP_Hdr* ip_hdr, const u_char* const pkt,
|
const IP_Hdr* ip_hdr, const u_char* const pkt,
|
||||||
int hdr_size)
|
int hdr_size)
|
||||||
|
@ -438,6 +444,7 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
|
||||||
proto != IPPROTO_ICMP )
|
proto != IPPROTO_ICMP )
|
||||||
{
|
{
|
||||||
dump_this_packet = 1;
|
dump_this_packet = 1;
|
||||||
|
delete_tunnel_info(tunnel_info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,6 +456,7 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
|
||||||
Weird("truncated_header", hdr, pkt);
|
Weird("truncated_header", hdr, pkt);
|
||||||
if ( f )
|
if ( f )
|
||||||
Remove(f); // ###
|
Remove(f); // ###
|
||||||
|
delete_tunnel_info(tunnel_info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( caplen < min_hdr_len )
|
if ( caplen < min_hdr_len )
|
||||||
|
@ -456,6 +464,7 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
|
||||||
Weird("internally_truncated_header", hdr, pkt);
|
Weird("internally_truncated_header", hdr, pkt);
|
||||||
if ( f )
|
if ( f )
|
||||||
Remove(f); // ###
|
Remove(f); // ###
|
||||||
|
delete_tunnel_info(tunnel_info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,6 +516,7 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Weird(fmt("unknown_protocol %d", proto), hdr, pkt);
|
Weird(fmt("unknown_protocol %d", proto), hdr, pkt);
|
||||||
|
delete_tunnel_info(tunnel_info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,6 +546,7 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
|
||||||
if ( consistent < 0 )
|
if ( consistent < 0 )
|
||||||
{
|
{
|
||||||
delete h;
|
delete h;
|
||||||
|
delete_tunnel_info(tunnel_info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,7 +569,10 @@ void NetSessions::DoNextPacket(double t, const struct pcap_pkthdr* hdr,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! conn )
|
if ( ! conn )
|
||||||
|
{
|
||||||
|
delete_tunnel_info(tunnel_info);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int record_packet = 1; // whether to record the packet at all
|
int record_packet = 1; // whether to record the packet at all
|
||||||
int record_content = 1; // whether to record its data
|
int record_content = 1; // whether to record its data
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue