use delete[], add assert
This commit is contained in:
parent
8b4cad8a3e
commit
8b4bc768a9
|
@ -71,9 +71,11 @@ void LINE_READER::expandCapacity( unsigned newsize )
|
||||||
// resize the buffer, and copy the original data
|
// resize the buffer, and copy the original data
|
||||||
char* bigger = new char[capacity];
|
char* bigger = new char[capacity];
|
||||||
|
|
||||||
|
wxASSERT( capacity >= length );
|
||||||
|
|
||||||
memcpy( bigger, line, length );
|
memcpy( bigger, line, length );
|
||||||
|
|
||||||
delete line;
|
delete[] line;
|
||||||
line = bigger;
|
line = bigger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue