diff --git a/src/vkr_renderer.c b/src/vkr_renderer.c index 09e9f74..f76b386 100644 --- a/src/vkr_renderer.c +++ b/src/vkr_renderer.c @@ -1046,16 +1046,24 @@ vkr_dispatch_vkCreateInstance(struct vn_dispatch_context *dispatch, ctx->instance = instance; } +static void +vkr_physical_device_destroy(struct vkr_context *ctx, + struct vkr_physical_device *physical_dev) +{ + free(physical_dev->extensions); + + util_hash_table_remove_u64(ctx->object_table, physical_dev->base.id); +} + static void vkr_instance_destroy(struct vkr_context *ctx, struct vkr_instance *instance) { - /* TODO cleanup all objects instead? */ for (uint32_t i = 0; i < instance->physical_device_count; i++) { struct vkr_physical_device *physical_dev = instance->physical_devices[i]; if (!physical_dev) break; - free(physical_dev->extensions); - util_hash_table_remove_u64(ctx->object_table, physical_dev->base.id); + + vkr_physical_device_destroy(ctx, physical_dev); } if (ctx->validate_level != VKR_CONTEXT_VALIDATE_NONE) {