]> git.kaiwu.me - nginx.git/commitdiff
Request cleanup code unified, no functional changes.
authorMaxim Dounin <mdounin@mdounin.ru>
Wed, 4 Sep 2013 17:17:00 +0000 (21:17 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Wed, 4 Sep 2013 17:17:00 +0000 (21:17 +0400)
Additionally, detaching a cleanup chain from a request is a bit more resilent
to various bugs if any.

src/http/ngx_http_request.c

index 5887376d41eb7da97915755059dac7ba74bf1da5..37efb2a52ca131e6717eb7a55de977f711777f58 100644 (file)
@@ -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)