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;
*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;
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_ */
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;
}
}
return ngx_event_pipe_drain_chains(p);
}
- ngx_chain_update_chains(&p->free, &p->busy, &out, p->tag);
+ ngx_chain_update_chains(p->pool, &p->free, &p->busy, &out, p->tag);
for (cl = p->free; cl; cl = cl->next) {
rc = ngx_http_next_body_filter(r, out);
- ngx_chain_update_chains(&ctx->free, &ctx->busy, &out,
+ ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &out,
(ngx_buf_tag_t) &ngx_http_chunked_filter_module);
return rc;
cl = NULL;
- ngx_chain_update_chains(&ctx->free, &ctx->busy, &cl,
+ ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &cl,
(ngx_buf_tag_t) &ngx_http_gzip_filter_module);
ctx->nomem = 0;
}
ngx_http_gzip_filter_free_copy_buf(r, ctx);
- ngx_chain_update_chains(&ctx->free, &ctx->busy, &ctx->out,
+ ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &ctx->out,
(ngx_buf_tag_t) &ngx_http_gzip_filter_module);
ctx->last_out = &ctx->out;
return;
}
- ngx_chain_update_chains(&u->free_bufs, &u->busy_bufs,
+ ngx_chain_update_chains(r->pool, &u->free_bufs, &u->busy_bufs,
&u->out_bufs, u->output.tag);
}