bind9/lib
Colin Vidal 4eb2cd364a copy __FILE__ when allocating memory
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.
2025-03-27 10:44:17 +01:00
..
dns Refactor to use list-like macro for message sections 2025-03-27 03:09:46 +01:00
isc copy __FILE__ when allocating memory 2025-03-27 10:44:17 +01:00
isccc Remove unused symtab implementation 2025-02-25 11:29:58 +01:00
isccfg Add an option to disable ZONEVERSION responses 2025-03-24 22:16:09 +00:00
ns Refactor to use list-like macro for message sections 2025-03-27 03:09:46 +01:00
.gitignore The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
Makefile.am Move irs_resconf into libdns and remove libirs 2023-02-24 09:38:59 +00:00