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
This commit is contained in:
Jeff Genovy 2017-01-13 01:48:47 +00:00
parent 645b425d97
commit 40f9b33eb7

View file

@ -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;
}