On 03/24/2011 04:52 PM, Bruno Haible wrote: > Leaking memory when you are already out of memory is not a problem: the > program will need to terminate very soon anyway. So code which calls > realloc(p,0) and does not free p if that returns NULL is just fine.
I hadn't thought of this argument, and it's a good one; thanks. Come to think of it, I don't know of any implementation where, if P is nonnull, then realloc (P, 0) can return NULL without freeing P. So even though C99 allows such behavior in theory, are we worrying about a memory-leak issue that is only theoretical?
