Skip to content
Snippets Groups Projects
Commit 3c3a84e0 authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

Merge branch 'memcpy-nullptr' into 'master'

CustomMemoryBuffer: only memcpy when not `nullptr`

See merge request walberla/walberla!340
parents b7df03fd 190f6385
Branches
Tags
No related merge requests found
......@@ -83,7 +83,10 @@ namespace communication {
newBegin = reinterpret_cast<ElementType *>(Allocator::allocate( newSize ));
Allocator::memcpy( newBegin, begin_, size_t(end_ - begin_) );
// memcpy: If either dest or src is an invalid or null pointer, the behavior is undefined, even if count is zero.
if(begin_) {
Allocator::memcpy( newBegin, begin_, size_t(end_ - begin_) );
}
std::swap( begin_, newBegin );
if( newBegin != nullptr )
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment