win: simplify registry closing in uv_cpu_info()

RegCloseKey() is the first thing executed in both the success
and error case, so combine the calls.

PR-URL: https://github.com/libuv/libuv/pull/2171
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
cjihrig 2019-02-02 13:50:39 -05:00
parent 110eb817bd
commit e2baa87b59
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -684,12 +684,9 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
NULL,
(BYTE*)&cpu_brand,
&cpu_brand_size);
if (err != ERROR_SUCCESS) {
RegCloseKey(processor_key);
goto error;
}
RegCloseKey(processor_key);
if (err != ERROR_SUCCESS)
goto error;
cpu_info = &cpu_infos[i];
cpu_info->speed = cpu_speed;