Leak check net_run detected leaks of 203 bytes in 4 objects
The 4 largest leaks:
Leak of 72 bytes in 1 objects allocated from:
@ 53e92d
Leak of 56 bytes in 1 objects allocated from:
@ 52fb66
@ 83f663
Leak of 56 bytes in 1 objects allocated from:
@ 52fd52
@ 20014
Leak of 19 bytes in 1 objects allocated from:
@ 53e9b6
Digging a little deeper shows that two of these leaks are in RE_parse (re-parse.y:110 and re-parse.y:133), one is in re__scan_buffer (re-scan.cc:2035), and one is in re__scan_bytes (re-scan.cc::2084).
The only regular expression that I have in the analyzer is: type NUL_String = RE/[^\0]*/;
I’m pretty sure that this isn’t really an issue, but can anyone help with figuring out how to get the btest to pass? I’d really like to have a memleak test for this.
I'm pretty sure I know where that's coming from: normally regexp
compilation is happening before Bro's main loop, and hence not
accounted for by the leak checking. BinPAC however delays
initialization until the first time it tries to match something.
Unfortunately the obvious fix doesn't work. I'm pasting it in below,
but that change lets Bro crash because it now depends on the order in
which global constructors run. If anybody has a better idea, let me
know.
Extending your idea a bit and probably hacking it into a place originally intended for something else. It may be a breaking change for other applications besides Bro, depending on how they define their RE_Matcher::Compile(), but not hard to fix.
I'm using your code but calling it slightly different via a new
binpac::init() function. Not sure it's much better, but a tiny bit
maybe. I've pushed the change into master but have actually not
tried yet if it indeed fixes the reported memleak.