As I see, this turned out to be a combination of a local patch applied to atexit.c.

The patch introduces cleanup of additionally allocated fl chunks allocated by calloc calls in __cxa_atexit.
I think I can upstream the patch upon a brief adaptation to match the styleguide.

What do you think?

NB: I am not a subscriber of this list and would like to be cc'd with any replies.
Thanks in advance.

Yuriy.

On Wed, 20 Jan 2021 at 16:54, Yuriy Chernyshov <georgthegreat@gmail.com> wrote:
Hello everyone,
34952fe5de44a833370cbe87b63fb8eec61466d7 introduced safeguard for using of undefined memory (de)allocation functions: https://git.musl-libc.org/cgit/musl/commit/?id=34952fe5de44a833370cbe87b63fb8eec61466d7

However, in src/exit/atexit.c either this commit or the code is buggy, as it has:

#define free undef

... free(something)

This results in linkage error of every program being linked to musl.
Could you, please, advice me on how to fix this?

Regards,
Yuriy.