]> git.kaiwu.me - nginx.git/commitdiff
Core: improved ngx_reset_pool() (ticket #490).
authorMaxim Dounin <mdounin@mdounin.ru>
Fri, 17 Jan 2014 02:24:53 +0000 (06:24 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Fri, 17 Jan 2014 02:24:53 +0000 (06:24 +0400)
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.

src/core/ngx_palloc.c

index efbc24452bd08cd81cfad38839caa8670b1796f7..1f70f9eee298d9b7151138048b12dee942b49995 100644 (file)
@@ -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;
 }