Skip to content

Commit

Permalink
ICU-21591 Release lock in SimpleDateFormat::tzFormat in case of failu…
Browse files Browse the repository at this point in the history
…re (#103)

Backport of unicode-org/icu#1699
  • Loading branch information
filipnavara authored Apr 19, 2021
1 parent 58af26e commit f8d1ccb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions icu/icu4c/source/i18n/smpdtfmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4262,11 +4262,9 @@ SimpleDateFormat::tzFormat(UErrorCode &status) const {
{
if (fTimeZoneFormat == NULL) {
TimeZoneFormat *tzfmt = TimeZoneFormat::createInstance(fLocale, status);
if (U_FAILURE(status)) {
return NULL;
if (U_SUCCESS(status)) {
const_cast<SimpleDateFormat *>(this)->fTimeZoneFormat = tzfmt;
}

const_cast<SimpleDateFormat *>(this)->fTimeZoneFormat = tzfmt;
}
}
umtx_unlock(LOCK());
Expand Down

0 comments on commit f8d1ccb

Please sign in to comment.