diff --git a/icu4c/source/common/utrie2_builder.cpp b/icu4c/source/common/utrie2_builder.cpp index 80e09c9c26..8de824cc3d 100644 --- a/icu4c/source/common/utrie2_builder.cpp +++ b/icu4c/source/common/utrie2_builder.cpp @@ -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; }