This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] mtrace: properly handle realloc (p, 0)
KOSAKI Motohiro <firstname.lastname@example.org> writes:
>> KOSAKI Motohiro <email@example.com> writes:
>>> realloc (p, 0) behavior is an implementation defined
> Interesting. So, I reread
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_400.htm. If we
> don't agree it is implementation defined. realloc(p, 0) should behave
> as BSD. then your patch is incorrect. no?
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.
Andreas Schwab, firstname.lastname@example.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."