ICU-3259 Fix a memory leak.

X-SVN-Rev: 13778
This commit is contained in:
George Rhoten 2003-11-19 23:44:51 +00:00
parent 8ab4bf13f7
commit b8b1565afe

View File

@ -1338,14 +1338,14 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// a little more permissive than RFC 822. It will try to do
// its best with numbers that aren't strictly 4 digits long.
UErrorCode status = U_ZERO_ERROR;
DecimalFormat *fmt = new DecimalFormat("+####;-####", status);
DecimalFormat fmt("+####;-####", status);
if(U_FAILURE(status))
return -start;
fmt->setParseIntegerOnly(TRUE);
fmt.setParseIntegerOnly(TRUE);
// WORK AROUND BUG IN NUMBER FORMAT IN 1.2B3
int32_t parseStart = pos.getIndex();
Formattable tzNumber;
fmt->parse( text, tzNumber, pos );
fmt.parse( text, tzNumber, pos );
if( pos.getIndex() == parseStart) {
// WORK AROUND BUG IN NUMBER FORMAT IN 1.2B3
return -start; // Wasn't actually a number.