From c784290e43bf89ef3c52f112d5e7e2d06f75ab69 Mon Sep 17 00:00:00 2001 From: Slawomir Cygan Date: Tue, 16 Jan 2018 17:17:07 +0100 Subject: Loader: fix open registry handle leak Each handle returned by RegOpenKey*() API functions should be closed using RegCloseKey(). This change fixes AppVerifier warning on leaklin HKEY objects. --- loader/loader.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'loader') diff --git a/loader/loader.c b/loader/loader.c index d7051008..0629d908 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -708,6 +708,7 @@ VkResult loaderGetRegistryFiles(const struct loader_instance *inst, char *locati if (NULL == *reg_data) { loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loaderGetRegistryFiles: Failed to allocate space for registry data for key %s", name); + RegCloseKey(key); result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -720,6 +721,7 @@ VkResult loaderGetRegistryFiles(const struct loader_instance *inst, char *locati inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loaderGetRegistryFiles: Failed to reallocate space for registry value of size %d for key %s", *reg_data_size * 2, name); + RegCloseKey(key); result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -738,6 +740,7 @@ VkResult loaderGetRegistryFiles(const struct loader_instance *inst, char *locati } name_size = 2048; } + RegCloseKey(key); } // Advance the location - if the next location is in the secondary hive, then reset the locations and advance the hive -- cgit v1.2.3