*) 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()
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c index a1c4c98..e8e059c 100644 --- a/src/http/ngx_http.c +++ b/src/http/ngx_http.c
@@ -1024,12 +1024,15 @@ 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;