Add check before copying data.

Fixes #7032.

[SVN r79333]
This commit is contained in:
John Maddock
2012-07-07 12:14:09 +00:00
parent 50795bcfec
commit 8d48db25cc

View File

@ -46,7 +46,8 @@ void BOOST_REGEX_CALL raw_storage::resize(size_type n)
// allocate and copy data:
register pointer ptr = static_cast<pointer>(::operator new(newsize));
BOOST_REGEX_NOEH_ASSERT(ptr)
std::memcpy(ptr, start, datasize);
if(start)
std::memcpy(ptr, start, datasize);
// get rid of old buffer:
::operator delete(start);