Opened 12 years ago

Closed 12 years ago

#5336 closed Bugs (invalid)

ptr_map_adapter::insert leaks on exception

Reported by: olafvdspek@… Owned by: Thorsten Ottosen
Milestone: Boost 1.47.0 Component: ptr_container
Version: Boost 1.46.0 Severity: Problem
Keywords: Cc:

Description

If enforce_null_policy() throws, x is lost.

        std::pair<iterator,bool> insert_impl( const key_type& key, mapped_type x ) // strong
        {
            this->enforce_null_policy( x, "Null pointer in ptr_map_adapter::insert()" );
            auto_type ptr( x );                                         // nothrow

            std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool>
                 res = this->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        
        }

Change History (2)

comment:1 by Olaf van der Spek <olafvdspek@…>, 12 years ago

Wasn't thinking, this one isn't valid, please close.

comment:2 by Thorsten Ottosen, 12 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.