Mercurial > hg > nginx
changeset 4833:3464d0b63300
Write filter: replaced unneeded loop with one to free chains.
Noted by Gabor Lekeny.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 05 Sep 2012 15:06:47 +0000 |
parents | 949ea3d3cd1a |
children | ed470a7bf7fd |
files | src/http/ngx_http_write_filter_module.c |
diffstat | 1 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http_write_filter_module.c Mon Sep 03 12:55:50 2012 +0000 +++ b/src/http/ngx_http_write_filter_module.c Wed Sep 05 15:06:47 2012 +0000 @@ -185,18 +185,14 @@ } if (size == 0 && !(c->buffered & NGX_LOWLEVEL_BUFFERED)) { - if (last) { - r->out = NULL; - c->buffered &= ~NGX_HTTP_WRITE_BUFFERED; + if (last || flush) { + for (cl = r->out; cl; /* void */) { + ln = cl; + cl = cl->next; + ngx_free_chain(r->pool, ln); + } - return NGX_OK; - } - - if (flush) { - do { - r->out = r->out->next; - } while (r->out); - + r->out = NULL; c->buffered &= ~NGX_HTTP_WRITE_BUFFERED; return NGX_OK;