mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
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:
parent
8627b87b3e
commit
bd9c937236
10 changed files with 113 additions and 8 deletions
16
src/Dict.cc
16
src/Dict.cc
|
@ -67,6 +67,19 @@ Dictionary::Dictionary(dict_order ordering, int initial_size)
|
|||
}
|
||||
|
||||
Dictionary::~Dictionary()
|
||||
{
|
||||
DeInit();
|
||||
delete order;
|
||||
}
|
||||
|
||||
void Dictionary::Clear()
|
||||
{
|
||||
DeInit();
|
||||
Init(2);
|
||||
tbl2 = 0;
|
||||
}
|
||||
|
||||
void Dictionary::DeInit()
|
||||
{
|
||||
for ( int i = 0; i < num_buckets; ++i )
|
||||
if ( tbl[i] )
|
||||
|
@ -84,7 +97,6 @@ Dictionary::~Dictionary()
|
|||
}
|
||||
|
||||
delete [] tbl;
|
||||
delete order;
|
||||
|
||||
if ( tbl2 == 0 )
|
||||
return;
|
||||
|
@ -103,7 +115,9 @@ Dictionary::~Dictionary()
|
|||
|
||||
delete chain;
|
||||
}
|
||||
|
||||
delete [] tbl2;
|
||||
tbl2 = 0;
|
||||
}
|
||||
|
||||
void* Dictionary::Lookup(const void* key, int key_size, hash_t hash) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue