From 7db46bbb3fea3f8e92f27cde2535a9b2ae54bcec Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 14 Oct 2014 16:54:10 +0100 Subject: [PATCH] Check alignment of address given to poolfree. Copied from Perforce Change: 187265 ServerID: perforce.ravenbrook.com --- mps/code/pool.c | 1 + mps/test/argerr/29.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mps/code/pool.c b/mps/code/pool.c index bbdacc68616..ce7fe6d4b24 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c @@ -321,6 +321,7 @@ void PoolFree(Pool pool, Addr old, Size size) AVER(old != NULL); /* The pool methods should check that old is in pool. */ AVER(size > 0); + AVER(AddrIsAligned(old, pool->alignment)); AVER(PoolHasRange(pool, old, AddrAdd(old, size))); (*pool->class->free)(pool, old, size); diff --git a/mps/test/argerr/29.c b/mps/test/argerr/29.c index 27418458aa2..d453b65c61d 100644 --- a/mps/test/argerr/29.c +++ b/mps/test/argerr/29.c @@ -6,8 +6,8 @@ TEST_HEADER link = testlib.o OUTPUT_SPEC assert = true - assertfile P= poolmfs.c - assertcond = + assertfile P= pool.c + assertcond = AddrIsAligned(old, pool->alignment) END_HEADER */