https://bugs.winehq.org/show_bug.cgi?id=50257
--- Comment #12 from Damjan Jovanovic damjan.jov@gmail.com --- (In reply to Gerald Pfeifer from comment #10)
Gen. (I'm not sure how this is related to the issue at hand.)
The crash is in the msvcrt DLLs, which export symbols with names similar to libc's symbols, just like that example code.
ELF's symbol handling is generally a nightmare, as symbols are always global instead of library-scoped (like on Windows and MacOS X), so when multiple libraries export the same symbol, it could end up matching the symbol in the wrong library. Here, the user-defined malloc probably overrides libc's, resulting in a crash as it has different ABI/semantics, possibly corrupting memory too.