libstdc++/6246: gcc generates code that memleaks
Carlo Wood
carlo@alinoe.com
Sun Apr 14 18:56:00 GMT 2002
The following reply was made to PR libstdc++/6246; it has been noted by GNATS.
From: Carlo Wood <carlo@alinoe.com>
To: Clemens Kirchgatterer <clemens@thf.ath.cx>
Cc: rodrigc@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/6246: gcc generates code that memleaks
Date: Mon, 15 Apr 2002 03:51:05 +0200
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-prs
mailing list