On Sunday 16 August 2026 12:02:49 Kirill Makurin wrote: > Pali Rohár <[email protected]> wrote: > > On Sunday 16 August 2026 11:54:57 Kirill Makurin wrote: > >> From my understanding, function `tdestroy` is a GNU extension and not > >> POSIX. I have a feeling that it should be responsible for setting the root > >> node to `NULL`, so that `twalk` will not walk freed nodes. > > > > That is not possible because tdestroy has API: > > > > void tdestroy(void *root, void (*free_node)(void *nodep)); > > > > Function is not taking pointer to variable, but the variable itself. > > So the function itself cannot set the caller's variable to NULL. > > Ah, I see. I still wonder if `tdestroy` should set freed nodes to `NULL` in > order to avoid possible dereference of those freed nodes.
It cannot. The root pointer is passed to free() function. So its memory is invalidated and can be recycled by the msvcrt memory allocator. _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
