mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-20537 jaEra: fix leak in SimpleDateFormat::applyPattern
This commit is contained in:
parent
2f06d1de55
commit
52d192e2b5
1 changed files with 2 additions and 2 deletions
|
@ -3909,13 +3909,13 @@ SimpleDateFormat::applyPattern(const UnicodeString& pattern)
|
|||
if (fSharedNumberFormatters != NULL) {
|
||||
Locale ovrLoc(fLocale.getLanguage(),fLocale.getCountry(),fLocale.getVariant(),"numbers=jpanyear");
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const SharedNumberFormat *snf = NULL;
|
||||
SharedObject::copyPtr(createSharedNumberFormat(ovrLoc, status), snf);
|
||||
const SharedNumberFormat *snf = createSharedNumberFormat(ovrLoc, status);
|
||||
if (U_SUCCESS(status)) {
|
||||
// Now that we have an appropriate number formatter, fill in the
|
||||
// appropriate slot in the number formatters table.
|
||||
UDateFormatField patternCharIndex = DateFormatSymbols::getPatternCharIndex(u'y');
|
||||
SharedObject::copyPtr(snf, fSharedNumberFormatters[patternCharIndex]);
|
||||
snf->deleteIfZeroRefCount();
|
||||
fDateOverride.setTo(u"y=jpanyear", -1); // record status
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue