Fix ngx_reset_pool


#1

HG changeset patch

User Liang S. removed_email_address@domain.invalid

Date 1468859189 -28800

Tue Jul 19 00:26:29 2016 +0800

Node ID 45ef1e0a48a82b2a81db6bc447aaeb16a10056f9

Parent 6acaa638fa074dada02ad4544a299584da9abc85

fix ngx_reset_pool

diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c
— a/src/core/ngx_palloc.c
+++ b/src/core/ngx_palloc.c
@@ -109,7 +109,8 @@ ngx_reset_pool(ngx_pool_t *pool)
}

 for (p = pool; p; p = p->d.next) {
  •    p->d.last = (u_char *) p + sizeof(ngx_pool_t);
    
  •    p->d.last = (u_char *) p +
    
  •        (p == pool ? sizeof(ngx_pool_t ) : 
    

sizeof(ngx_pool_data_t));
p->d.failed = 0;
}


#2

Hello!

On Tue, Jul 19, 2016 at 12:38:58AM +0800, 梁思健 wrote:

+++ b/src/core/ngx_palloc.c
@@ -109,7 +109,8 @@ ngx_reset_pool(ngx_pool_t *pool)
}

 for (p = pool; p; p = p->d.next) {
  •    p->d.last = (u_char *) p + sizeof(ngx_pool_t);
    
  •    p->d.last = (u_char *) p +
    
  •        (p == pool ? sizeof(ngx_pool_t ) : sizeof(ngx_pool_data_t));
       p->d.failed = 0;
    
    }

A previous attempt to “fix” this can be found here, it looks
slightly better from my point of view:

http://mailman.nginx.org/pipermail/nginx-devel/2010-June/000351.html

Though we are quite happy with the current code, while it is not
optimal - it is simple and good enough from practical point of
view.


Maxim D.
http://nginx.org/