Fix bug #884: No malloc for zero-sized matrices or for Ref without temporaries

This commit is contained in:
Christoph Hertzberg
2014-09-25 16:05:17 +02:00
parent 27d6b4daf9
commit 4ba8aa1482
2 changed files with 36 additions and 1 deletions

View File

@@ -454,6 +454,8 @@ template<typename T, bool Align> inline T* conditional_aligned_realloc_new(T* pt
template<typename T, bool Align> inline T* conditional_aligned_new_auto(size_t size)
{
if(size==0)
return 0; // short-cut. Also fixes Bug 884
check_size_for_overflow<T>(size);
T *result = reinterpret_cast<T*>(conditional_aligned_malloc<Align>(sizeof(T)*size));
if(NumTraits<T>::RequireInitialization)