aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2015-06-08 14:16:17 -0700
committerChristopher Ferris <cferris@google.com>2015-06-08 14:16:17 -0700
commitc429191e01e516d97bd501465289a351ef48d63a (patch)
tree7a0fed19f454d7b8e020ac56310f580474a4826e /src
parentff55436d8e692cfdf141923db002ae8bc8eceebb (diff)
downloadjemalloc-c429191e01e516d97bd501465289a351ef48d63a.tar.gz
Fix chunk size check.
If the chunk returned in chunk_recycle is too small to satisfy the current request, the code would still allow it to be reused. Make sure the chunk size is checked in all cases: Bug: 21633176 Change-Id: I04d2a682efaa3c177960b68a143afd2f6dbe17c4
Diffstat (limited to 'src')
-rw-r--r--src/chunk.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/chunk.c b/src/chunk.c
index 7063410..2e17cb2 100644
--- a/src/chunk.c
+++ b/src/chunk.c
@@ -130,8 +130,9 @@ chunk_recycle(arena_t *arena, extent_tree_t *chunks_szad,
node = chunk_first_fit(arena, chunks_szad, chunks_ad,
alloc_size);
}
- if (node == NULL || (new_addr != NULL && extent_node_size_get(node) <
- size)) {
+ /* ANDROID fix. */
+ if (node == NULL || extent_node_size_get(node) < size) {
+ /* End ANDROID fix. */
malloc_mutex_unlock(&arena->chunks_mtx);
return (NULL);
}