#9027 closed Patches (fixed)
Memory leaks in Lexer and Spirit classic
| Reported by: | Antony Polukhin | Owned by: | Joel de Guzman |
|---|---|---|---|
| Milestone: | Boost 1.55.0 | Component: | spirit |
| Version: | Boost Development Trunk | Severity: | Problem |
| Keywords: | Cc: |
Description
In boost/spirit/home/classic/tree/impl/tree_to_xml.ipp you may find the following code (line 71):
std::auto_ptr<wchar_t> result (new wchar_t[len+1]);
This will lead to memory leak (array myst be deallocated via delete [], but auto_ptr calls delete).
To fix that issue include <boost/scoped_array.hpp> and use boost::scoped_array<wchar_t> instead of std::auto_ptr<wchar_t>
Same error can be found in ./boost/spirit/home/lex/lexer/lexertl/generate_static.hpp at line 53.
Change History (3)
comment:1 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:3 by , 9 years ago
Replying to djowel:
Good catch! Thanks for spotting!
Thank the guys from PVS-Studio. They've found it.
P.S.: I've also reported all the other bugs from that article to library maintainers.

(In [85415]) Fixes #9027