summaryrefslogtreecommitdiff
path: root/libc/malloc_hooks/malloc_hooks.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-03-02 11:31:38 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-03-02 11:31:38 -0800
commitc32e6747b75b177a26cdfcb0526d6e4cb822a432 (patch)
treeb4c51aa233a9f76f42d1b01248fa0d553a7061f4 /libc/malloc_hooks/malloc_hooks.cpp
parent3fc715e803eb2853e6976955d44f5f438d0c5eb9 (diff)
parent5cbbc366989dfc53d6403e8afcf8d8a50385c321 (diff)
Merge "Make aligned_alloc match the standard." am: b8ef55a4f8 am: 4917f6f575
am: 5cbbc36698 Change-Id: I396705b8822e1fca827e214d5a622f0c2651c979
Diffstat (limited to 'libc/malloc_hooks/malloc_hooks.cpp')
-rw-r--r--libc/malloc_hooks/malloc_hooks.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/malloc_hooks/malloc_hooks.cpp b/libc/malloc_hooks/malloc_hooks.cpp
index f7bdd563a..715a6295b 100644
--- a/libc/malloc_hooks/malloc_hooks.cpp
+++ b/libc/malloc_hooks/malloc_hooks.cpp
@@ -176,7 +176,7 @@ int hooks_mallopt(int param, int value) {
void* hooks_aligned_alloc(size_t alignment, size_t size) {
if (__memalign_hook != nullptr && __memalign_hook != default_memalign_hook) {
- if (!powerof2(alignment)) {
+ if (!powerof2(alignment) || (size % alignment) != 0) {
errno = EINVAL;
return nullptr;
}