Fixing DNS memory leaks.

Some of the changes only clean up at termination to make perftools
happt, but there were some "real" leaks as well.

This fixes all DNS leaks I could reproducem, including most likely
what's reported in #534. Closing #534.

I'm also adding a new btest subdir core/leaks with tests requiring
perftools support. These don't compare against base lines but abort
whenever perftools reports a leak (with stack information to track it
down). Right now, these are passing.
This commit is contained in:
Robin Sommer 2011-10-08 18:54:58 -07:00
parent 8627b87b3e
commit bd9c937236
10 changed files with 113 additions and 8 deletions

View file

@ -0,0 +1,48 @@
# Needs perftools support.
#
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
#
# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -m -r $TRACES/wikipedia.trace %INPUT
# Add the state tracking information variable to the connection record
event connection_established(c: connection)
{
when ( local addrs = lookup_hostname("localhost") )
{
print "1a", c$id$resp_h, addrs;
}
timeout 100secs
{
print "1b", c$id$resp_h;
}
when ( local addrs2 = lookup_hostname("qq.ww.ee.rrrrr") )
{
print "2a", c$id$resp_h, addrs2;
}
timeout 100secs
{
print "2b", c$id$resp_h;
}
when ( local a = lookup_addr(c$id$resp_h) )
{
print "3a", c$id$resp_h, a;
}
timeout 100secs
{
print "3b", c$id$resp_h;
}
when ( local a2 = lookup_addr(1.2.3.4) )
{
print "4a", c$id$resp_h, a2;
}
timeout 100secs
{
print "4b", c$id$resp_h;
}
}