comparison src/core/ngx_alloc.c @ 128:1947c683490f

nginx-0.0.1-2003-08-08-19:13:24 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 08 Aug 2003 15:13:24 +0000
parents fcc79370b9a8
children b27548f540ad
comparison
equal deleted inserted replaced
127:4cbe22f9907f 128:1947c683490f
57 ngx_log_debug(pool->log, "free: %08x" _ l->alloc); 57 ngx_log_debug(pool->log, "free: %08x" _ l->alloc);
58 #endif 58 #endif
59 free(l->alloc); 59 free(l->alloc);
60 } 60 }
61 61
62 /* we can use pool->log so we have to free() pool after all */ 62 /*
63 * we could allocate pool->log from this pool
64 * so we can not use this log while free()ing the pool
65 */
63 66
64 for (p = pool->next; p ; p = n) {
65 #if (NGX_DEBUG_ALLOC) 67 #if (NGX_DEBUG_ALLOC)
68 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
66 ngx_log_debug(pool->log, "free: %08x" _ p); 69 ngx_log_debug(pool->log, "free: %08x" _ p);
70 }
67 #endif 71 #endif
68 n = p->next; 72
73 for (p = pool, n = pool->next; /* void */; p = n, n = n->next) {
69 free(p); 74 free(p);
75
76 if (n == NULL) {
77 break;
78 }
70 } 79 }
71 80
72 #if (NGX_DEBUG_ALLOC)
73 ngx_log_debug(pool->log, "free: %08x" _ pool);
74 #endif
75 free(pool);
76 pool = NULL; 81 pool = NULL;
77 } 82 }
78 83
79 void *ngx_palloc(ngx_pool_t *pool, size_t size) 84 void *ngx_palloc(ngx_pool_t *pool, size_t size)
80 { 85 {