summaryrefslogtreecommitdiffstats
path: root/jemalloc
diff options
context:
space:
mode:
authorJason Evans <je@facebook.com>2010-08-05 19:13:42 (GMT)
committerJason Evans <je@facebook.com>2010-08-05 19:13:42 (GMT)
commitdcd15098a8adfa6e44d7d1d041df968fb5fe9d82 (patch)
tree3b6aaa5038a328b55097c092ea56d8a077698515 /jemalloc
parent2541e1b083a81f29554dcba7b2eaa1cc9889219a (diff)
downloadjemalloc-dcd15098a8adfa6e44d7d1d041df968fb5fe9d82.zip
jemalloc-dcd15098a8adfa6e44d7d1d041df968fb5fe9d82.tar.gz
jemalloc-dcd15098a8adfa6e44d7d1d041df968fb5fe9d82.tar.bz2
Move assert() calls up in arena_run_reg_alloc().
Move assert() calls up in arena_run_reg_alloc(), so that a corrupt pointer will likely be caught by an assertion *before* it is dereferenced.
Diffstat (limited to 'jemalloc')
-rw-r--r--jemalloc/src/arena.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/jemalloc/src/arena.c b/jemalloc/src/arena.c
index e414226..ee859fc 100644
--- a/jemalloc/src/arena.c
+++ b/jemalloc/src/arena.c
@@ -254,7 +254,6 @@ arena_run_reg_alloc(arena_run_t *run, arena_bin_t *bin)
run->nfree--;
ret = run->avail;
if (ret != NULL) {
- run->avail = *(void **)ret;
/* Double free can cause assertion failure.*/
assert(ret != NULL);
/* Write-after free can cause assertion failure. */
@@ -264,6 +263,7 @@ arena_run_reg_alloc(arena_run_t *run, arena_bin_t *bin)
assert(((uintptr_t)ret - ((uintptr_t)run +
(uintptr_t)bin->reg0_offset)) % (uintptr_t)bin->reg_size ==
0);
+ run->avail = *(void **)ret;
return (ret);
}
ret = run->next;