mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 00:43:32 +00:00
ICU-12577 Fixed a potential null dereference issue in SimpleTimeZone.
X-SVN-Rev: 39815
This commit is contained in:
parent
76d9f7e502
commit
7cb98afd6a
1 changed files with 11 additions and 2 deletions
|
@ -1189,13 +1189,22 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) {
|
|||
// Create a TimeZoneRule for initial time
|
||||
if (firstStdStart < firstDstStart) {
|
||||
initialRule = new InitialTimeZoneRule(tzid+UnicodeString(DST_STR), getRawOffset(), dstRule->getDSTSavings());
|
||||
if (initialRule == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
deleteTransitionRules();
|
||||
return;
|
||||
}
|
||||
firstTransition = new TimeZoneTransition(firstStdStart, *initialRule, *stdRule);
|
||||
} else {
|
||||
initialRule = new InitialTimeZoneRule(tzid+UnicodeString(STD_STR), getRawOffset(), 0);
|
||||
if (initialRule == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
deleteTransitionRules();
|
||||
return;
|
||||
}
|
||||
firstTransition = new TimeZoneTransition(firstDstStart, *initialRule, *dstRule);
|
||||
}
|
||||
// Check for null pointers.
|
||||
if (initialRule == NULL || firstTransition == NULL) {
|
||||
if (firstTransition == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
deleteTransitionRules();
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue