bind9/tests
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
..
bench Replace isc_mem_destroy() with isc_mem_detach() 2025-03-05 11:17:17 +01:00
dns Add isc_sieve unit implementing SIEVE-LRU algorithm 2025-03-26 15:36:33 -07:00
include/tests Replace isc_mem_destroy() with isc_mem_detach() 2025-03-05 11:17:17 +01:00
isc copy __FILE__ when allocating memory 2025-03-27 10:44:17 +01:00
isccfg Move the library init and shutdown to executables 2025-02-22 16:19:00 +01:00
libtest Replace isc_mem_destroy() with isc_mem_detach() 2025-03-05 11:17:17 +01:00
ns wrap ns_client_error() for unit testing 2025-02-25 22:40:48 +00:00
.gitignore Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
Makefile.am Move resconf_test.c to tests/dns and cleanup 2024-12-12 22:16:36 +00:00
unit-test-driver.sh.in Reformat shell scripts with shfmt 2023-10-26 10:23:50 +02:00