diff src/core/ngx_alloc.c @ 126:fcc79370b9a8

nginx-0.0.1-2003-08-06-18:43:50 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 06 Aug 2003 14:43:50 +0000
parents 7db96f59bc29
children 1947c683490f
line wrap: on
line diff
--- a/src/core/ngx_alloc.c
+++ b/src/core/ngx_alloc.c
@@ -59,16 +59,20 @@ void ngx_destroy_pool(ngx_pool_t *pool)
         free(l->alloc);
     }
 
-    for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
+    /* we can use pool->log so we have to free() pool after all */
+
+    for (p = pool->next; p ; p = n) {
 #if (NGX_DEBUG_ALLOC)
         ngx_log_debug(pool->log, "free: %08x" _ p);
 #endif
+        n = p->next;
         free(p);
+    }
 
-        if (n == NULL) {
-            break;
-        }
-    }
+#if (NGX_DEBUG_ALLOC)
+    ngx_log_debug(pool->log, "free: %08x" _ pool);
+#endif
+    free(pool);
     pool = NULL;
 }