This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] mtrace: properly handle realloc (p, 0)
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."