projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
22a3550
)
Add some more correctness assertions to free().
author
Ben Pfaff
<blp@cs.stanford.edu>
Mon, 25 Oct 2004 23:39:46 +0000
(23:39 +0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Mon, 25 Oct 2004 23:39:46 +0000
(23:39 +0000)
(I did some basic testing on this.)
src/threads/malloc.c
patch
|
blob
|
history
diff --git
a/src/threads/malloc.c
b/src/threads/malloc.c
index 487e93875ef4124ac314a7355429d4c2a632d1ab..20773548d9ee2499b68a22e89e3b222694ef985c 100644
(file)
--- a/
src/threads/malloc.c
+++ b/
src/threads/malloc.c
@@
-228,8
+228,16
@@
static struct arena *
block_to_arena (struct block *b)
{
struct arena *a = pg_round_down (b);
+
+ /* Check that the arena is valid. */
ASSERT (a != NULL);
ASSERT (a->magic == ARENA_MAGIC);
+
+ /* Check that the block is properly aligned for the arena. */
+ ASSERT (a->desc == NULL
+ || (pg_ofs (b) - sizeof *a) % a->desc->block_size == 0);
+ ASSERT (a->desc != NULL || pg_ofs (b) == sizeof *a);
+
return a;
}