Skip to content

Commit

Permalink
Fix #1970 (#1971)
Browse files Browse the repository at this point in the history
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
  • Loading branch information
marcalff and lalitb authored Feb 10, 2023
1 parent d1fd49d commit 6d9c4ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/common/env_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ inline const std::string GetEnvironmentVariable(const char *env_var_name)
// avoid calling std::getenv which is deprecated in MSVC.
size_t required_size = 0;
getenv_s(&required_size, nullptr, 0, env_var_name);
std::unique_ptr<char> endpoint_buffer;
std::unique_ptr<char[]> endpoint_buffer;
if (required_size > 0)
{
endpoint_buffer = std::unique_ptr<char>{new char[required_size]};
endpoint_buffer = std::unique_ptr<char[]>{new char[required_size]};
getenv_s(&required_size, endpoint_buffer.get(), required_size, env_var_name);
endpoint_from_env = endpoint_buffer.get();
}
Expand Down

0 comments on commit 6d9c4ca

Please sign in to comment.