Date: Fri, 22 Nov 2002 16:33:44 +0100 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: Marc Recht <marc@informatik.uni-bremen.de> Cc: freebsd-current@FreeBSD.ORG Subject: Re: malloc(0) broken? Message-ID: <17192.1037979224@critter.freebsd.dk> In-Reply-To: Your message of "Fri, 22 Nov 2002 16:25:20 %2B0100." <79620000.1037978720@leeloo.intern.geht.de>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <79620000.1037978720@leeloo.intern.geht.de>, Marc Recht writes: >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. Then you didnt read malloc(3) well enough: 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. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. 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?17192.1037979224>