svn commit: r352451 - head/stand/libsa
Conrad Meyer
cem at freebsd.org
Tue Sep 17 23:18:24 UTC 2019
Well, hang on; it's also perfectly legal for a malloc implementation
to return NULL for requests of zero bytes. You can access exactly the
number of bytes requested in the allocation; and free(NULL) works as
expected. NULL (0) is also aligned to any size you could want.
Best,
Conrad
On Tue, Sep 17, 2019 at 9:16 AM Toomas Soome <tsoome at freebsd.org> wrote:
>
> Author: tsoome
> Date: Tue Sep 17 16:16:46 2019
> New Revision: 352451
> URL: https://svnweb.freebsd.org/changeset/base/352451
>
> Log:
> loader: revert r352421
>
> As insisted by kib, malloc(0) is quite legal.
>
> Modified:
> head/stand/libsa/zalloc_malloc.c
>
> Modified: head/stand/libsa/zalloc_malloc.c
> ==============================================================================
> --- head/stand/libsa/zalloc_malloc.c Tue Sep 17 15:53:40 2019 (r352450)
> +++ head/stand/libsa/zalloc_malloc.c Tue Sep 17 16:16:46 2019 (r352451)
> @@ -73,9 +73,6 @@ Malloc_align(size_t bytes, size_t alignment)
> {
> Guard *res;
>
> - if (bytes == 0)
> - return (NULL);
> -
> #ifdef USEENDGUARD
> bytes += MALLOCALIGN + 1;
> #else
More information about the svn-src-all
mailing list