Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Sep 2019 12:58:33 +0100
From:      Warner Losh <imp@bsdimp.com>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        "Conrad E. Meyer" <cem@freebsd.org>, Toomas Soome <tsoome@freebsd.org>,  src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>,  svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r352451 - head/stand/libsa
Message-ID:  <CANCZdfqiqarRuRZJYAgwESrsV08H55cshkhNX44Kq3VQZ52Ucg@mail.gmail.com>
In-Reply-To: <347a71f4-bbad-0d39-9e75-0564d06d7a1e@selasky.org>
References:  <201909171616.x8HGGlkb066218@repo.freebsd.org> <CAG6CVpW5V7%2BkZZyMBuF_8A3Ns3ETTfaBwqzBqhSq7Ve%2BPJoDJw@mail.gmail.com> <CANCZdfpa6d2aeGm5cC8DUMCjEVXUwSFST8x70D0tSL5JiTJ6VQ@mail.gmail.com> <347a71f4-bbad-0d39-9e75-0564d06d7a1e@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 18, 2019, 9:44 AM Hans Petter Selasky <hps@selasky.org> wrote:

> On 2019-09-18 10:37, Warner Losh wrote:
> > On Wed, Sep 18, 2019, 12:18 AM Conrad Meyer <cem@freebsd.org> wrote:
> >
> >> 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.
> >>
> >
> > Legal, yes.  But it is different than all the other FreeBSD environments,
> > so the loader becomes the odd man out. This restores the consistency.
> >
>
> Hi,
>
> The problem is the code that use malloc() that take NULL as a failure,
> even if the size is zero :-)
>
> array = malloc(n * sizeof(q));
> if (array == NULL)
>       goto failure;
>

Such code isn't portable...

Warner

--HPS
>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqiqarRuRZJYAgwESrsV08H55cshkhNX44Kq3VQZ52Ucg>