diff options
author | Igor Sysoev <igor@sysoev.ru> | 2003-08-08 15:13:24 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2003-08-08 15:13:24 +0000 |
commit | e77c0c359903cd94e43db8cc872778d3269f8d53 (patch) | |
tree | 9ba0197ccaf356a823af6248dac4b080880e3e2b /src/core/ngx_alloc.c | |
parent | 0939b8d7c64e28894cad8f5a62d61016c249f9de (diff) | |
download | nginx-e77c0c359903cd94e43db8cc872778d3269f8d53.tar.gz nginx-e77c0c359903cd94e43db8cc872778d3269f8d53.zip |
nginx-0.0.1-2003-08-08-19:13:24 import
Diffstat (limited to 'src/core/ngx_alloc.c')
-rw-r--r-- | src/core/ngx_alloc.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/core/ngx_alloc.c b/src/core/ngx_alloc.c index 110ab0161..311a34e26 100644 --- a/src/core/ngx_alloc.c +++ b/src/core/ngx_alloc.c @@ -59,20 +59,25 @@ void ngx_destroy_pool(ngx_pool_t *pool) free(l->alloc); } - /* we can use pool->log so we have to free() pool after all */ + /* + * we could allocate pool->log from this pool + * so we can not use this log while free()ing the pool + */ - for (p = pool->next; p ; p = n) { #if (NGX_DEBUG_ALLOC) + for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { ngx_log_debug(pool->log, "free: %08x" _ p); + } #endif - n = p->next; + + for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { free(p); + + if (n == NULL) { + break; + } } -#if (NGX_DEBUG_ALLOC) - ngx_log_debug(pool->log, "free: %08x" _ pool); -#endif - free(pool); pool = NULL; } |