mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-08 10:38:05 -04:00
When allocating memory under -m trace|record, the __FILE__ pointer is stored, so it can be printed out later in order to figure out in which file an allocation leaked. (among others, like the line number). However named crashes when called with -m record and using a plugin leaking memory. The reason is that plugins are unloaded earlier than when the leaked allocations are dumped (obviously, as it's done as late as possible). In such circumstances, __FILE__ is dangling because the dynamically loaded library (the plugin) is not in memory anymore. Fix the crash by systematically copying the __FILE__ string instead of copying the pointer. Of course, this make each allocation to consume a bit more memory (and longer, as it needs to calculate the length of __FILE__) but this occurs only under -m trace|record debugging flags. In term of unit test, because grepping in C is not fun, and because the whole "syntax" of the dump output is tested in other tests, this simply search for a substring in the whole buffer to make sure the expected allocations are found. |
||
|---|---|---|
| .. | ||
| dns | ||
| isc | ||
| isccc | ||
| isccfg | ||
| ns | ||
| .gitignore | ||
| Makefile.am | ||