diff src/http/ngx_http.c @ 2039:4d8140271204

*) add ngx_palloc_aligned() to allocate explicitlty aligned memory *) allows non-aligned memory blocks for small allocations and for odd length strings on all platforms *) use ngx_palloc_aligned()
author Igor Sysoev <igor@sysoev.ru>
date Tue, 27 May 2008 09:37:40 +0000
parents c036922f6f07
children 6389d4accacf
line wrap: on
line diff
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -1024,12 +1024,15 @@ ngx_http_create_locations_tree(ngx_conf_
     lq = (ngx_http_location_queue_t *) q;
     len = lq->name->len - prefix;
 
-    node = ngx_pcalloc(cf->pool,
-                       offsetof(ngx_http_location_tree_node_t, name) + len);
+    node = ngx_palloc_aligned(cf->pool,
+                          offsetof(ngx_http_location_tree_node_t, name) + len);
     if (node == NULL) {
         return NULL;
     }
 
+    node->left = NULL;
+    node->right = NULL;
+    node->tree = NULL;
     node->exact = lq->exact;
     node->inclusive = lq->inclusive;