]> granicus.if.org Git - icu/commitdiff
ICU-20369 ICU4C: Report OOM errors in the utrie2_clone function.
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Tue, 22 Jan 2019 01:01:24 +0000 (17:01 -0800)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Thu, 24 Jan 2019 01:33:05 +0000 (17:33 -0800)
icu4c/source/common/utrie2_builder.cpp

index 80e09c9c26b3e1c27c4eee5186cb71de88eb6688..8de824cc3d48cbc4c64ed72074a84d7fbe976abf 100644 (file)
@@ -309,6 +309,7 @@ utrie2_clone(const UTrie2 *other, UErrorCode *pErrorCode) {
 
     trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
     if(trie==NULL) {
+        *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
         return NULL;
     }
     uprv_memcpy(trie, other, sizeof(UTrie2));
@@ -333,6 +334,7 @@ utrie2_clone(const UTrie2 *other, UErrorCode *pErrorCode) {
     }
 
     if(trie->memory==NULL && trie->newTrie==NULL) {
+        *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
         uprv_free(trie);
         trie=NULL;
     }