This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libobjc/9751: malloc of strlen, not strlen+1
- From: Richard Frith-Macdonald <richard at brainstorm dot co dot uk>
- To: gcc-prs at gcc dot gnu dot org, john dot carter at tait dot co dot nz, gcc-bugs at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: Mon, 12 May 2003 09:51:54 +0100
- Subject: Re: libobjc/9751: malloc of strlen, not strlen+1
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9751
I was just looking at this ... and I don't think this is a bug.
If I understand the code correctly, it is removing a single byte (the
garbage collecting invisibility marker) from the type string. So the
length of the new string is one byte less than that of the original.
So allocating strlen(ivar->ivar_type) bytes is correct.
It might perhaps be worth adding a comment to thiks effect in the source
though.