This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Andrew Pimlott <pimlott@abel.MATH.HARVARD.EDU>] realloc(p, 0) vs. free


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   `------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]