Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2014-01-17 06:24:53 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2014-01-17 06:24:53 +0400
commit0bfb68eea0f41cfbada5a0e86d525027ed2f21e4 (patch)
tree03d75f09ce29d60525310b463ac348ae94b40db7 /src/core/ngx_palloc.c
parent1ef5553644e9becd61ac7a6e5d3a673374b947a5 (diff)
Core: improved ngx_reset_pool() (ticket #490).
Previously pool->current wasn't moved back to pool, resulting in blocks not used for further allocations if pool->current was already moved at the time of ngx_reset_pool(). Additionally, to preserve logic of moving pool->current, the p->d.failed counters are now properly cleared. While here, pool->chain is also cleared. This change is essentially a nop with current code, but generally improves things.
Diffstat (limited to 'src/core/ngx_palloc.c')
-rw-r--r--src/core/ngx_palloc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c
index efbc24452..1f70f9eee 100644
--- a/src/core/ngx_palloc.c
+++ b/src/core/ngx_palloc.c
@@ -105,11 +105,14 @@ ngx_reset_pool(ngx_pool_t *pool)
}
}
- pool->large = NULL;
-
for (p = pool; p; p = p->d.next) {
p->d.last = (u_char *) p + sizeof(ngx_pool_t);
+ p->d.failed = 0;
}
+
+ pool->current = pool;
+ pool->chain = NULL;
+ pool->large = NULL;
}