ICU-6554 Delete/close objects or pointers to avoid memory leaks.

X-SVN-Rev: 25725
This commit is contained in:
Michael Ow 2009-04-02 20:29:06 +00:00
parent 59fe26088c
commit 90318f8895
3 changed files with 7 additions and 1 deletions

View File

@ -903,6 +903,10 @@ int32_t CollData::minLengthInChars(const CEList *ceList, int32_t offset, int32_t
rlength = minLengthInChars(ceList, roffset, history);
if (rlength <= 0) {
// delete before continue to avoid memory leak.
#ifndef CACHE_CELISTS
delete ceList2;
#endif
// ignore any dead ends
continue;
}

View File

@ -2052,6 +2052,7 @@ void CalendarTest::Test3785()
if (U_FAILURE(status)) return;
//printf("formatted: '%s'\n", mkcstr(ubuffer));
udat_close(df);
return;
}

View File

@ -1856,11 +1856,12 @@ static UBool simpleSearch(UCollator *coll, const UnicodeString &target, int32_t
int32_t targetSize = targetOrders.size() - 1;
int32_t patternSize = patternOrders.size() - 1;
UBreakIterator *charBreakIterator = ubrk_open(UBRK_CHARACTER, ucol_getLocale(coll, ULOC_VALID_LOCALE, &status),
target.getBuffer(), target.length(), &status);
target.getBuffer(), target.length(), &status);
if (patternSize == 0) {
// Searching for an empty pattern always fails
matchStart = matchEnd = -1;
ubrk_close(charBreakIterator);
return FALSE;
}