On Sun Jun 11 07:15:29 2023 +0000, eric pouech wrote:
actually, the best way would be to use the pool_ helpers (each module (DLL with debug info avail) in dbghelp has its own heap, where are stored objects which life time is the one of the module: the main benefit is that the objects are not deallocated one by one, but the heap is destroyed when the module is unloaded) the real_path is just another attribute of the module, so allocating inside the module's pool is the best option you may have to implement pool_wcsdup though, add the module to struct build_search and remove the deallocation of real_path in module_remove
Because module->pool is not available until after search_builtin_pe has run, I think it would be easiest to allocate real_path with the CRT in all cases and then free it right after making a copy of it on the module heap. Could you take a look at v2 of this merge request and approve?