From 6cd8c0ece300b85e851921052303b4bac7f04c7e Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 24 Apr 2012 23:05:15 +0000 Subject: [PATCH] core: fix a bug in the Array class copy constructor, found thanks to the unit tests. --- src/array.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/array.h b/src/array.h index c3c96b40..30db4280 100644 --- a/src/array.h +++ b/src/array.h @@ -39,12 +39,13 @@ public: ArrayBase(ArrayBase const& that) : m_data(0), m_count(0), m_reserved(0) { Reserve(that.m_reserved); - memcpy(m_data, that.m_data, m_count * sizeof(Element)); + memcpy(m_data, that.m_data, that.m_count * sizeof(Element)); m_count = that.m_count; } ArrayBase& operator=(ArrayBase const& that) { + /* FIXME: delete old data!! */ m_data = 0; m_count = 0; m_reserved = 0;