From fee7f7c6ad7c4b5ace8a840929424fecd3e97121 Mon Sep 17 00:00:00 2001 From: Pranav Sharma Date: Thu, 14 Nov 2024 23:48:51 +0000 Subject: [PATCH] Fix memory leak issue in test --- sdk/test/trace/tracer_config_test.cc | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sdk/test/trace/tracer_config_test.cc b/sdk/test/trace/tracer_config_test.cc index c11ee8a81e..69504f7d83 100644 --- a/sdk/test/trace/tracer_config_test.cc +++ b/sdk/test/trace/tracer_config_test.cc @@ -36,38 +36,38 @@ std::pair attr3 = { "accept_third_attr", 3}; -const instrumentation_scope::InstrumentationScope instrumentation_scopes[] = { - *instrumentation_scope::InstrumentationScope::Create("test_scope_1").get(), - *instrumentation_scope::InstrumentationScope::Create("test_scope_2", "1.0").get(), - *instrumentation_scope::InstrumentationScope::Create("test_scope_3", - "0", - "https://opentelemetry.io/schemas/v1.18.0") - .get(), - *instrumentation_scope::InstrumentationScope::Create("test_scope_3", - "0", - "https://opentelemetry.io/schemas/v1.18.0", - {attr1}) - .get(), - *instrumentation_scope::InstrumentationScope::Create("test_scope_4", - "0", - "https://opentelemetry.io/schemas/v1.18.0", - {attr1, attr2, attr3}) - .get(), +const std::array instrumentation_scopes = { + instrumentation_scope::InstrumentationScope::Create("test_scope_1").get(), + instrumentation_scope::InstrumentationScope::Create("test_scope_2", "1.0").get(), + instrumentation_scope::InstrumentationScope::Create("test_scope_3", + "0", + "https://opentelemetry.io/schemas/v1.18.0") + .get(), + instrumentation_scope::InstrumentationScope::Create("test_scope_3", + "0", + "https://opentelemetry.io/schemas/v1.18.0", + {attr1}) + .get(), + instrumentation_scope::InstrumentationScope::Create("test_scope_4", + "0", + "https://opentelemetry.io/schemas/v1.18.0", + {attr1, attr2, attr3}) + .get(), }; // Test fixture for VerifyDefaultConfiguratorBehavior class DefaultTracerConfiguratorTestFixture - : public ::testing::TestWithParam + : public ::testing::TestWithParam {}; // verifies that the default configurator always returns the default tracer config TEST_P(DefaultTracerConfiguratorTestFixture, VerifyDefaultConfiguratorBehavior) { - const instrumentation_scope::InstrumentationScope &scope = GetParam(); + instrumentation_scope::InstrumentationScope *scope = GetParam(); trace_sdk::TracerConfigurator default_configurator = trace_sdk::TracerConfig::DefaultConfigurator(); - ASSERT_EQ(default_configurator(scope), trace_sdk::TracerConfig::Default()); + ASSERT_EQ(default_configurator(*scope), trace_sdk::TracerConfig::Default()); } INSTANTIATE_TEST_SUITE_P(InstrumentationScopes,