diff --git a/icu4c/source/i18n/ucurr.cpp b/icu4c/source/i18n/ucurr.cpp index 5dcfd6ac78d..85062e6a3aa 100644 --- a/icu4c/source/i18n/ucurr.cpp +++ b/icu4c/source/i18n/ucurr.cpp @@ -107,7 +107,9 @@ static UMTX gIsoCodesLock = NULL; static UBool U_CALLCONV isoCodes_cleanup(void) { - umtx_destroy(&gIsoCodesLock); + if (gIsoCodesLock != NULL) { + umtx_destroy(&gIsoCodesLock); + } if (gIsoCodes != NULL) { uhash_close(gIsoCodes); @@ -344,9 +346,11 @@ static UBool U_CALLCONV currency_cleanup(void) { CReg::cleanup(); #endif /* - * There might be some cached currency data. + * There might be some cached currency data or isoCodes data. */ currency_cache_cleanup(); + isoCodes_cleanup(); + return TRUE; } U_CDECL_END @@ -1931,6 +1935,8 @@ ucurr_isAvailable(const UChar* isoCode, UDate from, UDate to, UErrorCode* eError } uhash_setValueDeleter(gIsoCodes, deleteIsoCodeEntry); + ucln_i18n_registerCleanup(UCLN_I18N_CURRENCY, currency_cleanup); + ucurr_createCurrencyList(&status); if (U_FAILURE(status)) { umtx_unlock(&gIsoCodesLock);