Fix for #538946 Reported upstream as https://svn.boost.org/trac/boost/ticket/2647 Patch taken from http://www.nabble.com/-Boost.Test--valgrind-complains-about-invalid-reads-td20500154.html --- boost1.39-1.39.0.orig/boost/test/impl/framework.ipp +++ boost1.39-1.39.0/boost/test/impl/framework.ipp @@ -125,12 +125,8 @@ { while( !m_test_units.empty() ) { test_unit_store::value_type const& tu = *m_test_units.begin(); - // the delete will erase this element from map - if( test_id_2_unit_type( tu.second->p_id ) == tut_suite ) - delete (test_suite const*)tu.second; - else - delete (test_case const*)tu.second; + delete tu.second; } } --- boost1.39-1.39.0.orig/boost/test/unit_test_suite_impl.hpp +++ boost1.39-1.39.0/boost/test/unit_test_suite_impl.hpp @@ -71,8 +71,7 @@ void increase_exp_fail( unsigned num ); -protected: - ~test_unit(); + virtual ~test_unit(); private: // Data members