From cb05bc4d0be8bfded2f7c73f40218cee5b4607ff Mon Sep 17 00:00:00 2001 From: Chris Kennelly Date: Fri, 13 Dec 2024 16:01:33 -0800 Subject: [PATCH] Fix (unintended) undefined behavior in memory errors test. Aligned new must pair with aligned delete. PiperOrigin-RevId: 706028730 Change-Id: I6d73139d121e86e43addf9146d1a9349564bb277 --- tcmalloc/testing/memory_errors_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcmalloc/testing/memory_errors_test.cc b/tcmalloc/testing/memory_errors_test.cc index a4e4cb85e..35f28cbbb 100644 --- a/tcmalloc/testing/memory_errors_test.cc +++ b/tcmalloc/testing/memory_errors_test.cc @@ -109,7 +109,7 @@ TEST_F(GuardedAllocAlignmentTest, AlignedNew) { for (size_t align = 1; align <= kPageSize; align <<= 1) { void* p = ::operator new(1, static_cast(align)); EXPECT_EQ(reinterpret_cast(p) % align, 0); - ::operator delete(p); + ::operator delete(p, static_cast(align)); } }