This might be a significant leak since local.bro has the MHR and notary scripts loaded by default now and those use TXT lookups. Though, the leak is when there's a request for something that's already cached locally, that might happen often enough (same file/cert seen multiple times).
- Jon On Sep 4, 2013, at 4:50 PM, Jonathan Siwek <[email protected]> wrote: > Repository : ssh://[email protected]/bro > > On branch : fastpath > Link : > https://github.com/bro/bro/commit/62de5678f7532fb4c31bd7dce481491f5d11128a > >> --------------------------------------------------------------- > > commit 62de5678f7532fb4c31bd7dce481491f5d11128a > Author: Jon Siwek <[email protected]> > Date: Wed Sep 4 16:47:44 2013 -0500 > > Fix memory leak in DNS TXT lookups. > > >> --------------------------------------------------------------- > > 62de5678f7532fb4c31bd7dce481491f5d11128a > src/DNS_Mgr.cc | 12 +++++++++- > testing/btest/core/leaks/dns-txt.bro | 43 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 54 insertions(+), 1 deletion(-) > > diff --git a/src/DNS_Mgr.cc b/src/DNS_Mgr.cc > index 4596a7d..2005202 100644 > --- a/src/DNS_Mgr.cc > +++ b/src/DNS_Mgr.cc > @@ -713,6 +713,16 @@ void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct > nb_dns_result* r) > TextMap::iterator it = > text_mappings.find(dr->ReqHost()); > if ( it == text_mappings.end() ) > text_mappings[dr->ReqHost()] = new_dm; > + else > + { > + if ( new_dm->Failed() && prev_dm && > prev_dm->Valid() ) > + ++keep_prev; > + else > + { > + prev_dm = it->second; > + it->second = new_dm; > + } > + } > } > else > { > @@ -766,7 +776,7 @@ void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct > nb_dns_result* r) > } > } > > - if ( prev_dm ) > + if ( prev_dm && ! dr->ReqIsTxt() ) > CompareMappings(prev_dm, new_dm); > > if ( keep_prev ) > diff --git a/testing/btest/core/leaks/dns-txt.bro > b/testing/btest/core/leaks/dns-txt.bro > new file mode 100644 > index 0000000..44b7c04 > --- /dev/null > +++ b/testing/btest/core/leaks/dns-txt.bro > @@ -0,0 +1,43 @@ > +# Needs perftools support. > +# > +# @TEST-GROUP: leaks > +# > +# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks > +# > +# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local btest-bg-run bro > bro -b -m -r $TRACES/wikipedia.trace %INPUT > +# @TEST-EXEC: btest-bg-wait 15 > + > +@load base/frameworks/communication # keep network time running > +redef exit_only_after_terminate = T; > + > +global n1 = 0; > + > +function check_term_conditions() > + { > + if ( n1 > 7 ) > + terminate(); > + } > + > + > +event do_txt(s: string) > + { > + when ( local t1 = lookup_hostname_txt(s) ) > + { > + print "t1", t1; > + ++n1; > + check_term_conditions(); > + } > + timeout 100secs > + { > + print "t1 timeout"; > + ++n1; > + check_term_conditions(); > + } > + } > + > +event connection_established(c: connection) > + { > + event do_txt("localhost"); > + schedule 5sec { do_txt("localhost") }; > + } > + > > _______________________________________________ > bro-commits mailing list > [email protected] > http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-commits > _______________________________________________ bro-dev mailing list [email protected] http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev
