mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Add general LeakSanitizer macros/instrumentation
This commit is contained in:
parent
4735165d31
commit
447c3712cf
2 changed files with 36 additions and 0 deletions
10
src/main.cc
10
src/main.cc
|
@ -308,6 +308,8 @@ void done_with_network()
|
|||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
ZEEK_LSAN_DISABLE();
|
||||
}
|
||||
|
||||
void terminate_bro()
|
||||
|
@ -406,6 +408,7 @@ static void bro_new_handler()
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ZEEK_LSAN_DISABLE();
|
||||
std::set_new_handler(bro_new_handler);
|
||||
|
||||
// When running unit tests, the first argument on the command line must be
|
||||
|
@ -1052,6 +1055,13 @@ int main(int argc, char** argv)
|
|||
reporter->Warning("event handler never invoked: %s", handler.c_str());
|
||||
}
|
||||
|
||||
// Enable LeakSanitizer before zeek_init() and even before executing
|
||||
// top-level statements. Even though it's not bad if a leak happens only
|
||||
// once at initialization, we have to assume that script-layer code causing
|
||||
// such a leak can be placed in any arbitrary event handler and potentially
|
||||
// cause more severe problems.
|
||||
ZEEK_LSAN_ENABLE();
|
||||
|
||||
if ( stmts )
|
||||
{
|
||||
stmt_flow_type flow;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue