From a88f01d23a48faa40382074eedc9df03c32dd22f Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Fri, 30 Dec 2016 16:36:05 +0000 Subject: [PATCH] Bug 1325858 - Redundant handles open for HKLM\SYSTEM\ControlSet001\Control\TimeZoneInformation r=andrebargull --- intl/icu-patches/bug-1325858-close-key.diff | 26 +++++++++++++++++++++ intl/icu/source/common/wintz.c | 2 ++ intl/update-icu.sh | 1 + 3 files changed, 29 insertions(+) create mode 100644 intl/icu-patches/bug-1325858-close-key.diff diff --git a/intl/icu-patches/bug-1325858-close-key.diff b/intl/icu-patches/bug-1325858-close-key.diff new file mode 100644 index 000000000000..8068f06182d7 --- /dev/null +++ b/intl/icu-patches/bug-1325858-close-key.diff @@ -0,0 +1,26 @@ +getTZKeyName in common/wintz.cpp leaks registry handle. + +https://ssl.icu-project.org/trac/ticket/12908 + +diff --git a/intl/icu/source/common/wintz.c b/intl/icu/source/common/wintz.c +--- a/intl/icu/source/common/wintz.c ++++ b/intl/icu/source/common/wintz.c +@@ -211,16 +211,18 @@ static LONG getTZKeyName(char* tzKeyName + hkey, + "TimeZoneKeyName", + NULL, + NULL, + (LPBYTE)tzKeyName, + &cbData); + } + ++ RegCloseKey(hkey); ++ + return result; + } + + /* + This code attempts to detect the Windows time zone, as set in the + Windows Date and Time control panel. It attempts to work on + multiple flavors of Windows (9x, Me, NT, 2000, XP) and on localized + installs. It works by directly interrogating the registry and diff --git a/intl/icu/source/common/wintz.c b/intl/icu/source/common/wintz.c index a8696af39d4a..14fc476040c7 100644 --- a/intl/icu/source/common/wintz.c +++ b/intl/icu/source/common/wintz.c @@ -216,6 +216,8 @@ static LONG getTZKeyName(char* tzKeyName, int32_t length) { &cbData); } + RegCloseKey(hkey); + return result; } diff --git a/intl/update-icu.sh b/intl/update-icu.sh index 8311dc6cc9fb..7dc54eb6f9d3 100755 --- a/intl/update-icu.sh +++ b/intl/update-icu.sh @@ -61,6 +61,7 @@ for patch in \ bug-1172609-timezone-recreateDefault.diff \ bug-1198952-workaround-make-3.82-bug.diff \ bug-1228227-bug-1263325-libc++-gcc_hidden.diff \ + bug-1325858-close-key.diff \ ucol_getKeywordValuesForLocale-ulist_resetList.diff \ unum_formatDoubleForFields.diff \ ; do