ICU-20369 ICU4C: Report OOM errors in the utrie2_clone function.

This commit is contained in:
Jeff Genovy 2019-01-21 17:01:24 -08:00
parent 972e31d58d
commit 9b3030463f

View 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;
}