diff --git a/dw/hyphenator.cc b/dw/hyphenator.cc index 74a947b..ccfc14f 100644 --- a/dw/hyphenator.cc +++ b/dw/hyphenator.cc @@ -181,7 +181,8 @@ void Hyphenator::insertException (char *s) if((unsigned char)s[i] == 0xc2 && (unsigned char)s[i + 1] == 0xad) breaks->put (new Integer (i - 2 * breaks->size())); - char *noHyphens = new char[len - 2 * breaks->size() + 1]; + std::string noHyphens; + noHyphens.resize( len - 2 * breaks->size() + 1 ); int j = 0; for (int i = 0; i < len; ) { if(i < len - 1 && @@ -192,8 +193,7 @@ void Hyphenator::insertException (char *s) } noHyphens[j] = 0; - exceptions->put (new String (noHyphens), breaks); - delete[] noHyphens; + exceptions->put (new String (noHyphens.c_str()), breaks); } /**