From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Fri, 13 Jan 2017 01:48:47 +0000 (+0000) Subject: ICU-12908 getTZKeyName in common/wintz.cpp leaks registry handle X-Git-Tag: milestone-59-0-1~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=40f9b33eb7b2a7826bb1171794d39c20f1be52aa;p=icu ICU-12908 getTZKeyName in common/wintz.cpp leaks registry handle We should only call RegCloseKey if we were actually able to open the key. (The value of hkey isn't explicitly initialized, so we could possibly be calling RegCloseKey with random data.) X-SVN-Rev: 39556 --- diff --git a/icu4c/source/common/wintz.cpp b/icu4c/source/common/wintz.cpp index 14fc476040c..79526eb8082 100644 --- a/icu4c/source/common/wintz.cpp +++ b/icu4c/source/common/wintz.cpp @@ -165,11 +165,9 @@ static LONG getTZI(const char *winid, TZI *tzi) NULL, (LPBYTE)tzi, &cbData); - + RegCloseKey(hkey); } - RegCloseKey(hkey); - return result; } @@ -187,11 +185,9 @@ static LONG getSTDName(const char *winid, char *regStdName, int32_t length) { NULL, (LPBYTE)regStdName, &cbData); - + RegCloseKey(hkey); } - RegCloseKey(hkey); - return result; } @@ -214,9 +210,9 @@ static LONG getTZKeyName(char* tzKeyName, int32_t length) { NULL, (LPBYTE)tzKeyName, &cbData); - } - RegCloseKey(hkey); + RegCloseKey(hkey); + } return result; }