diff --git a/modules/time/src/timer.tests.cpp b/modules/time/src/timer.tests.cpp index e14afb0..4d7a98d 100644 --- a/modules/time/src/timer.tests.cpp +++ b/modules/time/src/timer.tests.cpp @@ -12,6 +12,8 @@ using lt::test::expect_le; // <1us error margin is tested manually in release builds and it works fine. constexpr auto max_error_margin = std::chrono::milliseconds { 1 }; +volatile int *volatile global_leak {}; + lt::test::Suite raii = [] { using std::chrono::microseconds; @@ -29,8 +31,8 @@ lt::test::Suite raii = [] { } }; - int *leak = new int(42); // Allocated memory, never freed - std::cout << "Hello, Valgrind!" << *leak << std::endl; + global_leak = new int(42); // Allocated memory, never freed + std::cout << "Hello, Valgrind!" << *global_leak << std::endl; }; lt::test::Suite reset_and_elapsed_time = [] {