 -        if (p->d.failed++ > 4) {
 -            current = p->d.next;
 -        }
-+    new = ngx_alloc(sizeof(ngx_pool_data_t), pool->log);
-+    if (new == NULL){
-+        ngx_free(m);
++    d = ngx_alloc(sizeof(ngx_pool_data_t), pool->log);
++    if (d == NULL){
++        ngx_free(p);
 +        return NULL;
      }
  

 #define NGINX_VAR          "NGINX"
diff -urx '*~' -x '*.swp' nginx-1.2.1/src/core/ngx_array.c nginx-1.2.1-patched/src/core/ngx_array.c
--- nginx-1.2.1/src/core/ngx_array.c	2012-02-06 04:02:59.000000000 +0800
+++ nginx-1.2.1-patched/src/core/ngx_array.c	2012-06-04 20:11:32.494144287 +0800
@@ -40,13 +40,11 @@
 
     p = a->pool;
 

-
-    pool->current = current ? current : new;
-
-    return m;
+    d->alloc = p;
+    d->next = pool->d;
+    pool->d = d;
+    return p;
 }
 
 
