]> granicus.if.org Git - icu/commitdiff
ICU-20194 TimeZone createSystemTimeZone doesn't set error code on OOM error.
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Mon, 17 Sep 2018 09:03:34 +0000 (02:03 -0700)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Thu, 25 Oct 2018 22:22:38 +0000 (15:22 -0700)
icu4c/source/i18n/timezone.cpp

index 234f52cc3dd70764d4d3301148466f5236b38134..bd3933e2e9566ca30901ca84599a9b8e0866807c 100644 (file)
@@ -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;
 }