This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


KOSAKI Motohiro <kosaki.motohiro@gmail.com> writes:

>> KOSAKI Motohiro <kosaki.motohiro@gmail.com> writes:
>>
>>> realloc (p, 0) behavior is an implementation defined
>>
>> No.
>
> 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.

-- 
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."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]