diff --git a/test/conformance/platform/fixtures.h b/test/conformance/platform/fixtures.h index c8170a4ea2..5b532fb433 100644 --- a/test/conformance/platform/fixtures.h +++ b/test/conformance/platform/fixtures.h @@ -14,12 +14,10 @@ struct urTest : ::testing::Test { void SetUp() override { ur_device_init_flags_t device_flags = 0; - ur_loader_config_handle_t config; - ASSERT_SUCCESS(urLoaderConfigCreate(&config)); - ASSERT_SUCCESS( - urLoaderConfigEnableLayer(config, "UR_LAYER_FULL_VALIDATION")); - ASSERT_SUCCESS(urInit(device_flags, config)); - ASSERT_SUCCESS(urLoaderConfigRelease(config)); + ASSERT_SUCCESS(urLoaderConfigCreate(&loader_config)); + ASSERT_SUCCESS(urLoaderConfigEnableLayer(loader_config, + "UR_LAYER_FULL_VALIDATION")); + ASSERT_SUCCESS(urInit(device_flags, loader_config)); uint32_t adapter_count; ASSERT_SUCCESS(urAdapterGet(0, nullptr, &adapter_count)); @@ -31,10 +29,14 @@ struct urTest : ::testing::Test { for (auto adapter : adapters) { ASSERT_SUCCESS(urAdapterRelease(adapter)); } + if (loader_config) { + ASSERT_SUCCESS(urLoaderConfigRelease(loader_config)); + } ur_tear_down_params_t tear_down_params{}; ASSERT_SUCCESS(urTearDown(&tear_down_params)); } + ur_loader_config_handle_t loader_config = nullptr; std::vector adapters; };