summaryrefslogtreecommitdiff
path: root/memory/unix/apr_pools.c
diff options
context:
space:
mode:
Diffstat (limited to 'memory/unix/apr_pools.c')
-rw-r--r--memory/unix/apr_pools.c9
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 */