From 0decc3e09433dd480862dbe608c04fec26c00795 Mon Sep 17 00:00:00 2001 From: yexo Date: Fri, 3 Sep 2010 23:04:02 +0000 Subject: (svn r20731) -Fix (r20739): SmallVector did not have an assignment operator, causing invalid memory reads / double free --- src/core/smallvec_type.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp index d64f4a744..89b12d5f5 100644 --- a/src/core/smallvec_type.hpp +++ b/src/core/smallvec_type.hpp @@ -36,12 +36,20 @@ protected: public: SmallVector() : data(NULL), items(0), capacity(0) { } - template + template SmallVector(const SmallVector &other) : data(NULL), items(0), capacity(0) { MemCpyT(this->Append(other.Length()), other.Begin(), other.Length()); } + template + SmallVector &operator=(const SmallVector &other) + { + this->Reset(); + MemCpyT(this->Append(other.Length()), other.Begin(), other.Length()); + return *this; + } + ~SmallVector() { free(this->data); -- cgit v1.2.3-54-g00ecf