On Tue, 2019-09-17 at 16:16 +0000, Toomas Soome 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

For the record, you're both right.  In both the C and posix standards
for malloc(), an implementation is allowed to return either NULL or a
unique pointer which cannot be used to access any memory but must be
passed to free().

-- Ian

_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to