summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-03-01 16:40:59 -0800
committerChristopher Ferris <cferris@google.com>2019-03-01 23:56:23 -0800
commita22f5d5175df5c42ec86d2c2db250edf1f64084c (patch)
tree66d2980a1b04626c7e4fc1437e96194b958ea8f8 /libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
parent0771b752f1b955e7ded6ccbbf825b0ae93439eb5 (diff)
Make aligned_alloc match the standard.
Jemalloc does not verify that the size parameter is a multiple of alignment. Fix this since it only went into P. Fix the unit tests, and fix malloc debug/malloc hooks to handle this new restrictive behavior. Bug: 126944692 Test: Ran bionic unit tests. Test: Ran bionic unit tests with malloc hooks enabled (no new tests fail). Test: Ran bionic unit tests with malloc debug enabled (no new tests fail). Test: Ran malloc debug unit tests. Change-Id: I4d50785928815679c781ca729f998454d76b9192
Diffstat (limited to 'libc/malloc_debug/tests/malloc_debug_unit_tests.cpp')
-rw-r--r--libc/malloc_debug/tests/malloc_debug_unit_tests.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
index 6da95caf5..a72db3b91 100644
--- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
@@ -318,7 +318,7 @@ TEST_F(MallocDebugTest, expand_alloc) {
ASSERT_LE(1039U, debug_malloc_usable_size(pointer));
debug_free(pointer);
- pointer = debug_aligned_alloc(128, 15);
+ pointer = debug_aligned_alloc(16, 16);
ASSERT_TRUE(pointer != nullptr);
ASSERT_LE(1039U, debug_malloc_usable_size(pointer));
debug_free(pointer);
@@ -2144,9 +2144,9 @@ void VerifyRecordAllocs() {
debug_free(pointer);
expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
- pointer = debug_aligned_alloc(32, 50);
+ pointer = debug_aligned_alloc(32, 64);
ASSERT_TRUE(pointer != nullptr);
- expected += android::base::StringPrintf("%d: memalign %p 32 50\n", getpid(), pointer);
+ expected += android::base::StringPrintf("%d: memalign %p 32 64\n", getpid(), pointer);
debug_free(pointer);
expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);