summaryrefslogtreecommitdiff
path: root/thirdparty/icu4c/common/normalizer2impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/icu4c/common/normalizer2impl.cpp')
-rw-r--r--thirdparty/icu4c/common/normalizer2impl.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/thirdparty/icu4c/common/normalizer2impl.cpp b/thirdparty/icu4c/common/normalizer2impl.cpp
index 5bfd49e8cb..e6bd75e717 100644
--- a/thirdparty/icu4c/common/normalizer2impl.cpp
+++ b/thirdparty/icu4c/common/normalizer2impl.cpp
@@ -2496,15 +2496,18 @@ void CanonIterData::addToStartSet(UChar32 origin, UChar32 decompLead, UErrorCode
// origin is not the first character, or it is U+0000.
UnicodeSet *set;
if((canonValue&CANON_HAS_SET)==0) {
- set=new UnicodeSet;
- if(set==NULL) {
- errorCode=U_MEMORY_ALLOCATION_ERROR;
+ LocalPointer<UnicodeSet> lpSet(new UnicodeSet, errorCode);
+ set=lpSet.getAlias();
+ if(U_FAILURE(errorCode)) {
return;
}
UChar32 firstOrigin=(UChar32)(canonValue&CANON_VALUE_MASK);
canonValue=(canonValue&~CANON_VALUE_MASK)|CANON_HAS_SET|(uint32_t)canonStartSets.size();
umutablecptrie_set(mutableTrie, decompLead, canonValue, &errorCode);
- canonStartSets.addElementX(set, errorCode);
+ canonStartSets.adoptElement(lpSet.orphan(), errorCode);
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
if(firstOrigin!=0) {
set->add(firstOrigin);
}