Skip to content

Commit

Permalink
acl_profiler_test: fix undefined behaviour with putenv()
Browse files Browse the repository at this point in the history
The buffer passed to putenv() becomes part of the environment. It is
the caller's responsibility to keep the buffer alive as long as the
environment variable is not modified by a subsequent invocation.

Signed-off-by: Peter Colberg <peter.colberg@intel.com>
  • Loading branch information
pcolberg committed Nov 7, 2022
1 parent 4b1a832 commit 900e86e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/acl_profiler_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ MT_TEST_GROUP(acl_profile) {
enum { MAX_DEVICES = 100, m_num_devices_in_context = 3 };
void setup() {
if (threadNum() == 0) {
char profile_runtime_env_var[] = "ACL_RUNTIME_PROFILING_ACTIVE=1";
char profiler_timer_env_var[] = "ACL_PROFILE_TIMER=1";
static char profile_runtime_env_var[] = "ACL_RUNTIME_PROFILING_ACTIVE=1";
static char profiler_timer_env_var[] = "ACL_PROFILE_TIMER=1";
#ifdef _WIN32
_putenv(profile_runtime_env_var);
_putenv(profiler_timer_env_var);
Expand Down

0 comments on commit 900e86e

Please # to comment.