This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: malloc(0)
- To: Roland McGrath <roland@frob.com>
- Subject: Re: malloc(0)
- From: Zack Weinberg <zack@rabi.phys.columbia.edu>
- Date: Mon, 01 Jun 1998 14:12:03 -0400
- cc: libc-hacker@cygnus.com
On Mon, 1 Jun 1998 13:54:21 -0400, Roland McGrath wrote:
>My recollection is that we made it that way quite a long time ago because
>existing programs assumed that behavior (malloc(0) != 0). You have cited
>no advantage whatsoever in changing it.
I was thinking that (a) it would flush out bugs, and (b) a program written
to assume that realloc(ptr, 0) is equivalent to free(ptr) would leak memory:
small quantities, but potentially significant.
If it's one of those things that is near-impossible to change because it
would break everything, then nevermind.
zw