This is the mail archive of the
libc-alpha@cygnus.com
mailing list for the glibc project.
Re: [Andrew Pimlott <pimlott@abel.MATH.HARVARD.EDU>] realloc(p, 0) vs. free
- To: Andreas Jaeger <aj@arthur.rhein-neckar.de>
- Subject: Re: [Andrew Pimlott <pimlott@abel.MATH.HARVARD.EDU>] realloc(p, 0) vs. free
- From: Roland McGrath <roland@frob.com>
- Date: Wed, 28 Apr 1999 13:42:35 -0400
- Cc: libc-alpha@cygnus.com, Andrew Pimlott <pimlott@abel.MATH.HARVARD.EDU>
There is no question about this. That is clearly a bug (and a relatively
recently introduced one). ANSI C requires that realloc(ptr,0) == free(ptr).
The only thing that is optional is whether malloc(0) returns null or
a block that can be freed.