From: Wayne Davison Date: Wed, 6 Jun 2007 15:38:31 +0000 (+0000) Subject: Allow a NULL address to be passed to pool_free_old() to indicate that X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/c04af6970114f2209fce571d35ad2b1511119dc8 Allow a NULL address to be passed to pool_free_old() to indicate that it should free all old mem and reset to an empty state. --- diff --git a/lib/pool_alloc.c b/lib/pool_alloc.c index 7d95f197..05b182c2 100644 --- a/lib/pool_alloc.c +++ b/lib/pool_alloc.c @@ -226,9 +226,15 @@ pool_free_old(alloc_pool_t p, void *addr) struct alloc_pool *pool = (struct alloc_pool *)p; struct pool_extent *cur, *prev, *next; - if (!pool || !addr) + if (!pool) return; + if (!addr) { + if (!pool->extents) + return; + addr = PTR_ADD(pool->extents->start, pool->extents->free); + } + for (prev = NULL, cur = pool->extents; cur; prev = cur, cur = cur->next) { if (addr >= cur->start && addr < PTR_ADD(cur->start, pool->size))