loader: return incomplete when count < available
authorJeremy Hayes <jeremy@lunarg.com>
Wed, 6 Jul 2016 18:02:03 +0000 (12:02 -0600)
committerJeremy Hayes <jeremy@lunarg.com>
Wed, 27 Jul 2016 16:10:09 +0000 (10:10 -0600)
The list was being destroyed before the check.

Change-Id: I500a22c8e2fffa8c852235f688026cd80f84088d

loader/trampoline.c

index 367a3ed..03c1c79 100644 (file)
@@ -253,12 +253,14 @@ vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
     }
 
     *pPropertyCount = copy_size;
-    loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
 
     if (copy_size < instance_layer_list.count) {
+        loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
         return VK_INCOMPLETE;
     }
 
+    loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
+
     return VK_SUCCESS;
 }