[PATCH] mtrace: properly handle realloc (p, 0)

Andreas Schwab schwab@linux-m68k.org
Thu Jan 3 00:02:00 GMT 2013


Paul Eggert <eggert@cs.ucla.edu> writes:

> On 01/02/2013 02:26 PM, Andreas Schwab wrote:
>> POSIX.1-2008 says: "If size is 0 and ptr is not a null pointer, the
>> object pointed to is freed."  That's pretty conclusive.
>
> It's not conclusive, unfortunately, because it's possible to
> interpret that section of POSIX.1-2008 as talking about only
> what happens when realloc succeeds.

That paragraph does not contain the word "succeed".  Moreover, the
return value section talks about "successful completion" only in
conncection with non-zero size.  That's as much conclusive as it can
get.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Libc-alpha mailing list