Index: source/i18n/ucurr.cpp |
diff --git a/source/i18n/ucurr.cpp b/source/i18n/ucurr.cpp |
index 5ee8ceef8cd882704d9a39970d05c9074cbdb381..cb955659f196cf36c9f9627c512bc80197e2c4ee 100644 |
--- a/source/i18n/ucurr.cpp |
+++ b/source/i18n/ucurr.cpp |
@@ -1007,6 +1007,12 @@ collectCurrencyNames(const char* locale, |
*currencySymbols = (CurrencyNameStruct*)uprv_malloc |
(sizeof(CurrencyNameStruct) * (*total_currency_symbol_count)); |
+ if(currencyNames == NULL || currencySymbols == NULL) { |
+ ec = U_MEMORY_ALLOCATION_ERROR; |
+ } |
+ |
+ if (U_FAILURE(ec)) return; |
+ |
const UChar* s = NULL; // currency name |
char* iso = NULL; // currency ISO code |
@@ -1174,6 +1180,15 @@ collectCurrencyNames(const char* locale, |
printf("len: %d\n", (*currencySymbols)[index].currencyNameLen); |
} |
#endif |
+ // fail on hashtable errors |
+ if (U_FAILURE(ec3)) { |
+ ec = ec3; |
+ return; |
+ } |
+ if (U_FAILURE(ec4)) { |
+ ec = ec4; |
+ return; |
+ } |
} |
// @param currencyNames: currency names array |