Boost C++ Libraries: Ticket #5335: ptr_map_adapter::insert leaks on exception https://svn.boost.org/trac10/ticket/5335 <p> If enforce_null_policy() throws, x is lost. </p> <pre class="wiki"> std::pair&lt;iterator,bool&gt; insert_impl( const key_type&amp; key, mapped_type x ) // strong { this-&gt;enforce_null_policy( x, "Null pointer in ptr_map_adapter::insert()" ); auto_type ptr( x ); // nothrow std::pair&lt;BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool&gt; res = this-&gt;base().insert( std::make_pair( key, x ) ); // strong, commit if( res.second ) // nothrow ptr.release(); // nothrow return std::make_pair( iterator( res.first ), res.second ); // nothrow } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5335 Trac 1.4.3 Thorsten Ottosen Thu, 31 Mar 2011 20:27:42 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5335#comment:1 https://svn.boost.org/trac10/ticket/5335#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> Ticket