diff options
author | Joe Orton <jorton@apache.org> | 2005-08-24 14:13:29 +0000 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2005-08-24 14:13:29 +0000 |
commit | 9792205ea4116fbb3136244047ebb84d6a7b6649 (patch) | |
tree | e9f8ef5eeab3a244d03d429a3336f0a33ce5ec37 /memory | |
parent | 366ca71566c123d4bc7643641c1a34c02c9c470a (diff) | |
download | apr-9792205ea4116fbb3136244047ebb84d6a7b6649.tar.gz |
* memory/unix/apr_pools.c (apr_pool_cleanup_kill) [APR_POOL_DEBUG]:
Add some cheap loop detection to abort if the cleanup list is corrupt.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@239666 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory')
-rw-r--r-- | memory/unix/apr_pools.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index 335516fd5..291abc3d6 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -1974,6 +1974,15 @@ APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data, c = p->cleanups; lastp = &p->cleanups; while (c) { +#if APR_POOL_DEBUG + /* Some cheap loop detection to catch a corrupt list: */ + if (c == c->next + || (c->next && c == c->next->next) + || (c->next && c->next->next && c == c->next->next->next)) { + abort(); + } +#endif + if (c->data == data && c->plain_cleanup_fn == cleanup_fn) { *lastp = c->next; /* move to freelist */ |