...
This noncompliant example provides definitions for the C standard library functions malloc() and free(). Although this practice is permitted by many traditional implementations of UNIX (e.g.for example, the Dmalloc library), it is disallowed by the C Standard because it is undefined behavior. Even on systems that allow replacing malloc(), doing so without also replacing calloc() and realloc() is likely to cause problems.
...
The behavior of a program is undefined when
a macro definition of
errnois suppressed in order to access an actual object, or the program defines an identifier with the nameerrno. [ISO/IEC 9899:2011]
...