Skip to content

Commit

Permalink
Verify RegisterProfilerManager doesn't overwrite an existing registra…
Browse files Browse the repository at this point in the history
…tion

Tested:
Add a second registration to test/profiler_manager_test.cc and
verify the test crashes as expected.
  • Loading branch information
xdje42 committed Aug 8, 2024
1 parent b884717 commit b66b20b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,10 @@ void RegisterMemoryManager(MemoryManager* manager) {
}

void RegisterProfilerManager(ProfilerManager* manager) {
// Don't allow overwriting an existing manager.
if (manager != nullptr) {
BM_CHECK_EQ(internal::profiler_manager, nullptr);
}
internal::profiler_manager = manager;
}

Expand Down

0 comments on commit b66b20b

Please sign in to comment.