Skip to content

Commit

Permalink
Fix (unintended) undefined behavior in memory errors test.
Browse files Browse the repository at this point in the history
Aligned new must pair with aligned delete.

PiperOrigin-RevId: 706028730
Change-Id: I6d73139d121e86e43addf9146d1a9349564bb277
  • Loading branch information
ckennelly authored and copybara-github committed Dec 14, 2024
1 parent efebb2f commit cb05bc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tcmalloc/testing/memory_errors_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ TEST_F(GuardedAllocAlignmentTest, AlignedNew) {
for (size_t align = 1; align <= kPageSize; align <<= 1) {
void* p = ::operator new(1, static_cast<std::align_val_t>(align));
EXPECT_EQ(reinterpret_cast<uintptr_t>(p) % align, 0);
::operator delete(p);
::operator delete(p, static_cast<std::align_val_t>(align));
}
}

Expand Down

0 comments on commit cb05bc4

Please sign in to comment.