[PATCH] Return NULL for zero size allocations
Chris Johns
chrisj at rtems.org
Wed May 5 06:58:24 UTC 2021
On 5/5/21 4:52 pm, Sebastian Huber wrote:
> In POSIX, zero size memory allocations are implementation-defined
> behaviour. The implementation has two options:
>
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html
>
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html
>
> Linux and FreeBSD return a unique pointer for zero size memory
> allocations. Return NULL on RTEMS to more likely catch the use of a
> zero size memory area by erroneous applications.
>
> Update #4390.
Huh? Are we going in circles here [1]?
Chris
[1] https://git.rtems.org/rtems/commit/?id=d692c62dfbf834c16ef7f171ea3161b3f3fac06b
More information about the devel
mailing list