From 3bf890b9ecc583528631a375e5df84a180502288 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Tue, 3 Aug 2010 17:29:36 +0000 Subject: [PATCH] * do not leak ICU timezone * minor cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37876 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/locale/TimeZone.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kits/locale/TimeZone.cpp b/src/kits/locale/TimeZone.cpp index dfb4066f63..f08e04100f 100644 --- a/src/kits/locale/TimeZone.cpp +++ b/src/kits/locale/TimeZone.cpp @@ -78,10 +78,10 @@ BTimeZone::SetTo(const char* zoneCode) int32_t rawOffset; int32_t dstOffset; UDate nowMillis = 1000 * (double)time(NULL); + UErrorCode error = U_ZERO_ERROR; icuTimeZone->getOffset(nowMillis, FALSE, rawOffset, dstOffset, error); - - if (error != U_ZERO_ERROR) { + if (!U_SUCCESS(error)) { fOffsetFromGMT = 0; fInitStatus = B_ERROR; } else { @@ -90,5 +90,7 @@ BTimeZone::SetTo(const char* zoneCode) fInitStatus = B_OK; } + delete icuTimeZone; + return fInitStatus; }