From 4b189002af160515fdd523b3d1802c050268c45f Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Wed, 4 Sep 2013 21:17:00 +0400 Subject: [PATCH] Request cleanup code unified, no functional changes. Additionally, detaching a cleanup chain from a request is a bit more resilent to various bugs if any. --- src/http/ngx_http_request.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 5887376d4..37efb2a52 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -3343,10 +3343,15 @@ ngx_http_free_request(ngx_http_request_t *r, ngx_int_t rc) return; } - for (cln = r->cleanup; cln; cln = cln->next) { + cln = r->cleanup; + r->cleanup = NULL; + + while (cln) { if (cln->handler) { cln->handler(cln->data); } + + cln = cln->next; } #if (NGX_STAT_STUB)