# HG changeset patch # User Maxim Dounin # Date 1378315020 -14400 # Node ID 31af4ae8ad9c7cf0f6711bbfc8774744a31881fc # Parent 79b9101cecf4fc177c6c61e35cd719f728abd147 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. diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c --- 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 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)