From 4dc0689cab945da9bbefdcf250857e35a9cc9320 Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Mon, 2 May 2011 05:58:17 +0000 Subject: [PATCH] ICU-8273 Delete object before creating a new one in PluralFormat copy assignment operator. X-SVN-Rev: 29951 --- icu4c/source/i18n/plurfmt.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/icu4c/source/i18n/plurfmt.cpp b/icu4c/source/i18n/plurfmt.cpp index 980eb01a76..4424034ac8 100644 --- a/icu4c/source/i18n/plurfmt.cpp +++ b/icu4c/source/i18n/plurfmt.cpp @@ -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 {