This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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: libstdc++/6246: gcc generates code that memleaks


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>


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