mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-6905 Fix memory leak when data is not present.
X-SVN-Rev: 26098
This commit is contained in:
parent
6b1f9ef27c
commit
5ecf5bd261
2 changed files with 10 additions and 8 deletions
|
@ -240,13 +240,15 @@ CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& st
|
|||
// TODO: Java
|
||||
// parse to check whether there is ";" separator in the numberStylePattern
|
||||
UBool hasSeparator = false;
|
||||
for (int32_t styleCharIndex = 0; styleCharIndex < ptnLen; ++styleCharIndex) {
|
||||
if (numberStylePattern[styleCharIndex] == gNumberPatternSeparator) {
|
||||
hasSeparator = true;
|
||||
// split the number style pattern into positive and negative
|
||||
negNumberStylePattern = numberStylePattern + styleCharIndex + 1;
|
||||
negNumberStylePatternLen = ptnLen - styleCharIndex - 1;
|
||||
numberStylePatternLen = styleCharIndex;
|
||||
if (U_SUCCESS(ec)) {
|
||||
for (int32_t styleCharIndex = 0; styleCharIndex < ptnLen; ++styleCharIndex) {
|
||||
if (numberStylePattern[styleCharIndex] == gNumberPatternSeparator) {
|
||||
hasSeparator = true;
|
||||
// split the number style pattern into positive and negative
|
||||
negNumberStylePattern = numberStylePattern + styleCharIndex + 1;
|
||||
negNumberStylePatternLen = ptnLen - styleCharIndex - 1;
|
||||
numberStylePatternLen = styleCharIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
ures_close(numberPatterns);
|
||||
|
|
|
@ -27,7 +27,7 @@ U_NAMESPACE_BEGIN
|
|||
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SpoofImpl)
|
||||
|
||||
SpoofImpl::SpoofImpl(SpoofData *data, UErrorCode &status) :
|
||||
fMagic(0), fSpoofData(NULL), fAllowedCharsSet(NULL) {
|
||||
fMagic(0), fSpoofData(NULL), fAllowedCharsSet(NULL) , fAllowedLocales(NULL) {
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue