BUG: realloc(p,0) should be consistent with malloc(0)

Wilco Dijkstra Wilco.Dijkstra@arm.com
Thu Jun 19 20:07:35 GMT 2025


Hi Paul,

> 2. When p is not null, realloc(p,0) frees p, returns NULL, and sets
> errno=EINVAL. This conforms to both POSIX.1-2017 and POSIX.1-2024.

That's interesting, was POSIX getting the idea of setting errno from AIX perhaps?

However POSIX.1-2024 actually requires that the old block must not be freed
if errno is set...

Cheers,
Wilco 


More information about the Libc-alpha mailing list