Closed GoogleCodeExporter closed 9 years ago
Original comment by rsc@golang.org
on 10 Jan 2014 at 3:26
There is a bug in your program.
StringPiece sp_contents(ss.str());
ss.str() returns a temporary string, which must be copied in order to be
preserved. StringPiece records a pointer into that string but then it is
deallocated. The inconsistency happens because the data is being changed by
something else (it has been reallocated) while the search runs.
string s = ss.str();
StringPiece sp_contents(s);
will work much better.
Original comment by rsc@golang.org
on 10 Jan 2014 at 3:52
Original issue reported on code.google.com by
oliver.w...@gmail.com
on 10 Jan 2012 at 10:28Attachments: