Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Nov 2002 17:43:42 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Marc Recht <marc@informatik.uni-bremen.de>
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: malloc(0) broken?
Message-ID:  <20021122154342.GA584@gothmog.gr>
In-Reply-To: <79620000.1037978720@leeloo.intern.geht.de>
References:  <79620000.1037978720@leeloo.intern.geht.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2002-11-22 16:25, Marc Recht <marc@informatik.uni-bremen.de> wrote:
> Hi!
> 
> A malloc(0) returns always 0x800 on my system. This causes some third-party 
> software to fail, because they expect malloc(0) to return NULL. Is this a 
> bug or a feature? malloc(3) doesn't mention anything.

malloc(3) does mention something.  Look at the description of the V
malloc option.  In the manpage you will also find various ways of
turning this option on or off for your programs.

:    V       Attempting to allocate zero bytes will return a NULL pointer
:	     instead of a valid pointer.  (The default behavior is to make a
:	     minimal allocation and return a pointer to it.)  This option is
:	     provided for System V compatibility.  This option is incompatible
:	     with the ``X'' option.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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