From 13ad1fe4e031a0358d17c48022a3b2fa3f446112 Mon Sep 17 00:00:00 2001 From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Mon, 17 Sep 2018 02:03:34 -0700 Subject: [PATCH] ICU-20194 TimeZone createSystemTimeZone doesn't set error code on OOM error. --- icu4c/source/i18n/timezone.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/icu4c/source/i18n/timezone.cpp b/icu4c/source/i18n/timezone.cpp index 234f52cc3dd..bd3933e2e95 100644 --- a/icu4c/source/i18n/timezone.cpp +++ b/icu4c/source/i18n/timezone.cpp @@ -390,7 +390,8 @@ createSystemTimeZone(const UnicodeString& id, UErrorCode& ec) { if (U_SUCCESS(ec)) { z = new OlsonTimeZone(top, &res, id, ec); if (z == NULL) { - U_DEBUG_TZ_MSG(("cstz: olson time zone failed to initialize - err %s\n", u_errorName(ec))); + ec = U_MEMORY_ALLOCATION_ERROR; + U_DEBUG_TZ_MSG(("cstz: olson time zone failed to initialize - err %s\n", u_errorName(ec))); } } ures_close(&res); @@ -398,7 +399,7 @@ createSystemTimeZone(const UnicodeString& id, UErrorCode& ec) { if (U_FAILURE(ec)) { U_DEBUG_TZ_MSG(("cstz: failed to create, err %s\n", u_errorName(ec))); delete z; - z = 0; + z = NULL; } return z; } -- 2.40.0