aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/util/Memory.h
diff options
context:
space:
mode:
authorGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2014-09-25 16:05:17 +0200
committerGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2014-09-25 16:05:17 +0200
commit4ba8aa14822ae0b444baa9e0d41d8744cdcd6b03 (patch)
treec1c0abd45012c09a8e2cf9583226b146d41ce501 /Eigen/src/Core/util/Memory.h
parent27d6b4daf90488e105d70f45e5d5684b8f1a906d (diff)
Fix bug #884: No malloc for zero-sized matrices or for Ref without temporaries
Diffstat (limited to 'Eigen/src/Core/util/Memory.h')
-rw-r--r--Eigen/src/Core/util/Memory.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h
index 30133ba67..af46c449c 100644
--- a/Eigen/src/Core/util/Memory.h
+++ b/Eigen/src/Core/util/Memory.h
@@ -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)