Boost C++ Libraries: Ticket #5336: ptr_map_adapter::insert leaks on exception https://svn.boost.org/trac10/ticket/5336 <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/5336 Trac 1.4.3 Olaf van der Spek <olafvdspek@…> Sat, 19 Mar 2011 17:20:59 GMT <link>https://svn.boost.org/trac10/ticket/5336#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5336#comment:1</guid> <description> <p> Wasn't thinking, this one isn't valid, please close. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Thorsten Ottosen</dc:creator> <pubDate>Thu, 31 Mar 2011 20:26:51 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5336#comment:2 https://svn.boost.org/trac10/ticket/5336#comment:2 <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