From 32871bfceb9bafbc04c60e0ccd148c39a94976f9 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Thu, 24 May 2012 02:55:41 +0000 Subject: [PATCH] Fixed delete vs. delete[] in SimpleString - possible source of subtle errors --- CppUnitLite/SimpleString.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CppUnitLite/SimpleString.cpp b/CppUnitLite/SimpleString.cpp index 19dc7f258..190010d87 100644 --- a/CppUnitLite/SimpleString.cpp +++ b/CppUnitLite/SimpleString.cpp @@ -41,7 +41,7 @@ SimpleString::SimpleString (const SimpleString& other) SimpleString SimpleString::operator= (const SimpleString& other) { - delete buffer_; + delete [] buffer_; buffer_ = new char [other.size() + 1]; strcpy(buffer_, other.buffer_); return *this; @@ -50,7 +50,7 @@ SimpleString SimpleString::operator= (const SimpleString& other) SimpleString SimpleString::operator+ (const SimpleString& other) { SimpleString ret; - delete ret.buffer_; + delete [] ret.buffer_; ret.buffer_ = new char [size() + other.size() - 1]; strcpy(ret.buffer_, buffer_); strcat(ret.buffer_, other.buffer_);