[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: tolua potential memory leak?
- From: Adriano Ferreira <a.r.ferreira@...>
- Date: Thu, 24 Feb 2005 17:22:39 -0300
On Thu, 24 Feb 2005 17:07:52 -0300, Alex Sandro Queiroz e Silva >
The address of the string would be meaningless after the return of
> this function, wouldn't it?
I don't think so. The literal "some string" in C code must be treated
as a constant char array with a valid address. The compiler will
usually save it somewhere with a well defined memory space. But it
should not be changed in general. Or you risk seeing other contents
when passing through it again, besides the possible buffer overflow
hazzards if the original length is not respected when it is modified.