Avoid stack overflow in make_shared. Refs #4256.

[SVN r83198]
This commit is contained in:
Peter Dimov
2013-02-28 08:02:09 +00:00
parent 46d119c385
commit 82e178f043
2 changed files with 8 additions and 4 deletions

View File

@@ -200,7 +200,7 @@ public:
}
catch( ... )
{
D()( p ); // delete p
D::operator_fn( p ); // delete p
throw;
}
@@ -210,7 +210,7 @@ public:
if( pi_ == 0 )
{
D()( p ); // delete p
D::operator_fn( p ); // delete p
boost::throw_exception( std::bad_alloc() );
}
@@ -286,7 +286,7 @@ public:
}
catch(...)
{
D()( p );
D::operator_fn( p );
if( pi_ != 0 )
{
@@ -306,7 +306,7 @@ public:
}
else
{
D()( p );
D::operator_fn( p );
boost::throw_exception( std::bad_alloc() );
}

View File

@@ -87,6 +87,10 @@ public:
destroy();
}
static void operator_fn( T* ) // operator() can't be static
{
}
void * address() BOOST_NOEXCEPT
{
return storage_.data_;