From e2baa87b59d184f586ee19f0f3f8049ff4e17c58 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 2 Feb 2019 13:50:39 -0500 Subject: [PATCH] win: simplify registry closing in uv_cpu_info() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Reviewed-By: Santiago Gimeno --- src/win/util.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/win/util.c b/src/win/util.c index 92378912..a5ec8492 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -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;