summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2007-06-06 15:38:31 +0000
committerWayne Davison <wayned@samba.org>2007-06-06 15:38:31 +0000
commitc04af6970114f2209fce571d35ad2b1511119dc8 (patch)
treed1995be0c4dc910795bb026c4278c80572f1f7be /lib
parentf87fb190b3bd1250a07ff12161db2107d7717263 (diff)
downloadrsync-c04af6970114f2209fce571d35ad2b1511119dc8.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/pool_alloc.c8
1 files changed, 7 insertions, 1 deletions
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))