Skip to content

Commit 900e86e

Browse files
committed
acl_profiler_test: fix undefined behaviour with putenv()
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 <[email protected]>
1 parent 4b1a832 commit 900e86e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/acl_profiler_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ MT_TEST_GROUP(acl_profile) {
5050
enum { MAX_DEVICES = 100, m_num_devices_in_context = 3 };
5151
void setup() {
5252
if (threadNum() == 0) {
53-
char profile_runtime_env_var[] = "ACL_RUNTIME_PROFILING_ACTIVE=1";
54-
char profiler_timer_env_var[] = "ACL_PROFILE_TIMER=1";
53+
static char profile_runtime_env_var[] = "ACL_RUNTIME_PROFILING_ACTIVE=1";
54+
static char profiler_timer_env_var[] = "ACL_PROFILE_TIMER=1";
5555
#ifdef _WIN32
5656
_putenv(profile_runtime_env_var);
5757
_putenv(profiler_timer_env_var);

0 commit comments

Comments
 (0)