diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ngx_buf.c | 16 | ||||
-rw-r--r-- | src/core/ngx_buf.h | 4 | ||||
-rw-r--r-- | src/core/ngx_output_chain.c | 3 |
3 files changed, 13 insertions, 10 deletions
diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c index 2f2c43721..53cd50cea 100644 --- a/src/core/ngx_buf.c +++ b/src/core/ngx_buf.c @@ -180,7 +180,7 @@ ngx_chain_get_free_buf(ngx_pool_t *p, ngx_chain_t **free) void -ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, +ngx_chain_update_chains(ngx_pool_t *p, ngx_chain_t **free, ngx_chain_t **busy, ngx_chain_t **out, ngx_buf_tag_t tag) { ngx_chain_t *cl; @@ -197,19 +197,21 @@ ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, *out = NULL; while (*busy) { - if (ngx_buf_size((*busy)->buf) != 0) { + cl = *busy; + + if (ngx_buf_size(cl->buf) != 0) { break; } - if ((*busy)->buf->tag != tag) { - *busy = (*busy)->next; + if (cl->buf->tag != tag) { + *busy = cl->next; + ngx_free_chain(p, cl); continue; } - (*busy)->buf->pos = (*busy)->buf->start; - (*busy)->buf->last = (*busy)->buf->start; + cl->buf->pos = cl->buf->start; + cl->buf->last = cl->buf->start; - cl = *busy; *busy = cl->next; cl->next = *free; *free = cl; diff --git a/src/core/ngx_buf.h b/src/core/ngx_buf.h index 847eaad05..a6bf39ff3 100644 --- a/src/core/ngx_buf.h +++ b/src/core/ngx_buf.h @@ -154,8 +154,8 @@ ngx_int_t ngx_chain_writer(void *ctx, ngx_chain_t *in); ngx_int_t ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in); ngx_chain_t *ngx_chain_get_free_buf(ngx_pool_t *p, ngx_chain_t **free); -void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, - ngx_chain_t **out, ngx_buf_tag_t tag); +void ngx_chain_update_chains(ngx_pool_t *p, ngx_chain_t **free, + ngx_chain_t **busy, ngx_chain_t **out, ngx_buf_tag_t tag); #endif /* _NGX_BUF_H_INCLUDED_ */ diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c index 4f100a818..e45f0342d 100644 --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -208,7 +208,8 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) return last; } - ngx_chain_update_chains(&ctx->free, &ctx->busy, &out, ctx->tag); + ngx_chain_update_chains(ctx->pool, &ctx->free, &ctx->busy, &out, + ctx->tag); last_out = &out; } } |