loader: Fix freeing of uninitialized list
The memset of icd_tramp_list in terminator_EnumerateInstanceExtensionPropeties
was inside an else-branch. If an error occured in the preceding if branch, this
would cause the cleanup code to run on a non-zerod out icd_tramp_list.
Change-Id: I7af1da31580f01c54c4ffababbb9c7ecfa8966d8
diff --git a/loader/loader.c b/loader/loader.c
index 58381dd..a74b755 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -7785,6 +7785,7 @@
// tls_instance = NULL;
memset(&local_ext_list, 0, sizeof(local_ext_list));
memset(&instance_layers, 0, sizeof(instance_layers));
+ memset(&icd_tramp_list, 0, sizeof(icd_tramp_list));
// Get layer libraries if needed
if (pLayerName && strlen(pLayerName) != 0) {
@@ -7809,7 +7810,6 @@
loader_preload_icds();
// Scan/discover all ICD libraries
- memset(&icd_tramp_list, 0, sizeof(icd_tramp_list));
res = loader_icd_scan(NULL, &icd_tramp_list);
// EnumerateInstanceExtensionProperties can't return anything other than OOM or VK_ERROR_LAYER_NOT_PRESENT
if ((VK_SUCCESS != res && icd_tramp_list.count > 0) || res == VK_ERROR_OUT_OF_HOST_MEMORY) {