* do not leak ICU timezone

* minor cleanup

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37876 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2010-08-03 17:29:36 +00:00
parent 308ca58d67
commit 3bf890b9ec
1 changed files with 4 additions and 2 deletions

View File

@ -78,10 +78,10 @@ BTimeZone::SetTo(const char* zoneCode)
int32_t rawOffset; int32_t rawOffset;
int32_t dstOffset; int32_t dstOffset;
UDate nowMillis = 1000 * (double)time(NULL); UDate nowMillis = 1000 * (double)time(NULL);
UErrorCode error = U_ZERO_ERROR; UErrorCode error = U_ZERO_ERROR;
icuTimeZone->getOffset(nowMillis, FALSE, rawOffset, dstOffset, error); icuTimeZone->getOffset(nowMillis, FALSE, rawOffset, dstOffset, error);
if (!U_SUCCESS(error)) {
if (error != U_ZERO_ERROR) {
fOffsetFromGMT = 0; fOffsetFromGMT = 0;
fInitStatus = B_ERROR; fInitStatus = B_ERROR;
} else { } else {
@ -90,5 +90,7 @@ BTimeZone::SetTo(const char* zoneCode)
fInitStatus = B_OK; fInitStatus = B_OK;
} }
delete icuTimeZone;
return fInitStatus; return fInitStatus;
} }