ICU-20647 Fix TimeZone leak in ucal_open if uloc_setKeywordValue fails.
This commit is contained in:
parent
78f341ce7e
commit
e56b19662c
@ -140,8 +140,8 @@ ucal_open( const UChar* zoneID,
|
||||
|
||||
if(U_FAILURE(*status)) return 0;
|
||||
|
||||
TimeZone* zone = (zoneID==NULL) ? TimeZone::createDefault()
|
||||
: _createTimeZone(zoneID, len, status);
|
||||
LocalPointer<TimeZone> zone( (zoneID==NULL) ? TimeZone::createDefault()
|
||||
: _createTimeZone(zoneID, len, status), *status);
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
@ -157,9 +157,9 @@ ucal_open( const UChar* zoneID,
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
return (UCalendar*)Calendar::createInstance(zone, Locale(localeBuf), *status);
|
||||
return (UCalendar*)Calendar::createInstance(zone.orphan(), Locale(localeBuf), *status);
|
||||
}
|
||||
return (UCalendar*)Calendar::createInstance(zone, Locale(locale), *status);
|
||||
return (UCalendar*)Calendar::createInstance(zone.orphan(), Locale(locale), *status);
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
|
Loading…
Reference in New Issue
Block a user