On Mon, Jun 18, 2012 at 4:50 PM, Brandon Black <blbl...@gmail.com> wrote:
> However, whether it's a
> simple bug or somehow intentional behavior is unclear to me given all
> that arguing about malloc(p,0) between glibc/C/POSIX people.

Shortly after the last email, I noticed the realloc() docs in Fedora
16 contain this sentence about realloc():

"If size was equal to 0, either NULL or a pointer suitable to be
passed to free() is returned."

Sure enough, realloc(p, 0) returns a non-NULL pointer, and free(p) of
that return value also stops the leak.  Another summary of some of the
differences of interpretation going on here:
http://lists.gnu.org/archive/html/bug-gnulib/2011-03/msg00243.html .
IMHO, in a world with that kind of mess going on, the new "safe"
behavior for portable code may just be to never use realloc(p,0)
because you can't trust what it means :(

-- Brandon

_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to