From 8b4bc768a9538774afa07893f5847fe218ca63e3 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 20 Oct 2010 18:11:00 -0500 Subject: [PATCH] use delete[], add assert --- common/richio.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/richio.cpp b/common/richio.cpp index a4e40087cb..3791e44566 100644 --- a/common/richio.cpp +++ b/common/richio.cpp @@ -71,9 +71,11 @@ void LINE_READER::expandCapacity( unsigned newsize ) // resize the buffer, and copy the original data char* bigger = new char[capacity]; + wxASSERT( capacity >= length ); + memcpy( bigger, line, length ); - delete line; + delete[] line; line = bigger; } }