Wierd free() problem.
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Tue Aug 31 22:45:00 GMT 1999
> I have checked several times by hand that the "buffer" variable is not
> used after the location where it is freed, and have also stepped through
> the code with GDB, using "watch" to check for any change, and not found
> any, so I cannot see any reason why moving the free() call further down
> would make a difference.
[...]
> If you have any questions, feel free to e-mail me. Good luck (and I hope
> this isn't just me missing something :) )!
It *is* a problem in your code. To see it, I suggest that you compile
with -lmcheck, which will give you a diagnosis from malloc.
The problem is that you are overwriting the internal malloc data
structures when writing beyond the end of a buffer in a call to#
strcpybck(Start + withLength, Start + Length);
which in turn originates from
this -> Buffer.Replace(start, (end - start) + endLength, (char *)listBuffer -> Buffer);
Hope this helps,
Martin
More information about the Gcc-bugs
mailing list