From: Colin Vidal Date: Thu, 27 Mar 2025 12:15:24 +0000 (+0000) Subject: fix: dev: copy __FILE__ when allocating memory X-Git-Tag: v9.21.7~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d6839d832db49dcf3258bea5645316779a2ae76;p=thirdparty%2Fbind9.git fix: dev: 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. Merge branch 'colin-memdump-plugins' into 'main' See merge request isc-projects/bind9!10320 --- 0d6839d832db49dcf3258bea5645316779a2ae76