From dbdf90119db97b7b239f18fc8be17d32c4dfc95e Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 17 Jun 2013 17:52:25 +0100 Subject: [PATCH] Move the poolhasrange test to pool.c so that all frees (including internal ones) get the check. Copied from Perforce Change: 182783 ServerID: perforce.ravenbrook.com --- mps/code/mpsi.c | 5 ++--- mps/code/pool.c | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 820838da2e6..dede080ea45 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -1,7 +1,7 @@ /* mpsi.c: MEMORY POOL SYSTEM C INTERFACE LAYER * * $Id$ - * Copyright (c) 2001-2003, 2006 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. * Portions copyright (c) 2002 Global Graphics Software. * * .purpose: This code bridges between the MPS interface to C, @@ -753,7 +753,6 @@ void mps_free(mps_pool_t pool, mps_addr_t p, size_t size) ArenaEnter(arena); AVERT(Pool, pool); - AVER(PoolHasRange(pool, p, AddrAdd(p, size))); AVER(size > 0); /* Note: class may allow unaligned size, see */ /* . */ @@ -1942,7 +1941,7 @@ void mps_chain_destroy(mps_chain_t chain) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2003, 2006, 2008 Ravenbrook Limited . + * Copyright (C) 2001-2013 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/pool.c b/mps/code/pool.c index ad9967925f7..bc0283f75bf 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c @@ -1,7 +1,7 @@ /* pool.c: POOL IMPLEMENTATION * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2001 Global Graphics Software. * * DESIGN @@ -320,6 +320,8 @@ 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(PoolHasRange(pool, old, AddrAdd(old, size))); + (*pool->class->free)(pool, old, size); EVENT3(PoolFree, pool, old, size); @@ -663,7 +665,7 @@ Bool PoolHasRange(Pool pool, Addr base, Addr limit) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2002 Ravenbrook Limited . + * Copyright (C) 2001-2013 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. *