From 9b3030463fdfce3d2a8c8a32436798e7bdf0011c Mon Sep 17 00:00:00 2001 From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Mon, 21 Jan 2019 17:01:24 -0800 Subject: [PATCH] ICU-20369 ICU4C: Report OOM errors in the utrie2_clone function. --- icu4c/source/common/utrie2_builder.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/icu4c/source/common/utrie2_builder.cpp b/icu4c/source/common/utrie2_builder.cpp index 80e09c9c26b..8de824cc3d4 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; }