libstdc++/6246: gcc generates code that memleaks
Carlo Wood
carlo@alinoe.com
Sun Apr 14 19:37:00 GMT 2002
On Sat, Apr 13, 2002 at 08:29:34AM +0200, Clemens Kirchgatterer wrote:
> hmm, this is very strange, as it is NOT gcc's fault, but mine.
>
> *buf += str.str(); <-- this freazes the buffer and returns a
> pointer to it. the caller is now
> responsible for freeing it with delete().
No it doesn't, not since 3.0 which is conforming to the standard
and where str() returns a std::string. Use std::stringstream,
not std::strstream.
--
Carlo Wood <carlo@alinoe.com>
More information about the Gcc-bugs
mailing list