ICU-8273 Delete object before creating a new one in PluralFormat copy assignment operator.

X-SVN-Rev: 29951
This commit is contained in:
Michael Ow 2011-05-02 05:58:17 +00:00
parent c6bd9357a9
commit 4dc0689cab

View File

@ -122,6 +122,13 @@ PluralFormat::PluralFormat(const PluralFormat& other)
void
PluralFormat::copyObjects(const PluralFormat& other) {
UErrorCode status = U_ZERO_ERROR;
if (numberFormat != NULL) {
delete numberFormat;
}
if (pluralRulesWrapper.pluralRules != NULL) {
delete pluralRulesWrapper.pluralRules;
}
if (other.numberFormat == NULL) {
numberFormat = NumberFormat::createInstance(locale, status);
} else {