summaryrefslogtreecommitdiff
path: root/libc/malloc_hooks/malloc_hooks.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-03-02 11:23:30 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-03-02 11:23:30 -0800
commit4917f6f57533793fd3e48a5e213c7ff120f556c4 (patch)
tree66d2980a1b04626c7e4fc1437e96194b958ea8f8 /libc/malloc_hooks/malloc_hooks.cpp
parent4c35405d24be3dc9c0f0e7ef28200f1097b2ca62 (diff)
parentb8ef55a4f841cb1e790e97776ee51419ec5d9bd1 (diff)
Merge "Make aligned_alloc match the standard."
am: b8ef55a4f8 Change-Id: I21b8bd658b93e2bd5a7036733cedda5e3852d18f
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;
}