[Andrew Pimlott <pimlott@abel.MATH.HARVARD.EDU>] realloc(p, 0) vs. free
Ulrich Drepper
drepper@cygnus.com
Wed Apr 28 16:01:00 GMT 1999
Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> writes:
> Well, as the comment in the source says, when malloc(0) returns a
> unique pointer (like it does currently in glibc) it seems consistent
> that realloc(...,0) does so too. So, if the standard really requires
> that realloc(...,0) frees then we should also consider changing
> malloc(0) to return NULL IMHO.
No. Please look at the change I've added.
realloc (NULL, 0) == malloc (0)
realloc (ptr, 0) == free (ptr)
--
---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com `------------------------
More information about the Libc-alpha
mailing list