ICU-20369 ICU4C: Report OOM errors in the utrie2_clone function.
This commit is contained in:
parent
972e31d58d
commit
9b3030463f
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user