From 2e94c81b0bf1d8e695d9afd074c79520aa03081a Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Thu, 10 Dec 2020 20:09:39 +0300 Subject: [PATCH] Removed extra allocation for r->uri. The ngx_http_parse_complex_uri() function cannot make URI longer and does not null-terminate URI, so there is no need to allocate an extra byte. This allocation appears to be a leftover from changes in 461:a88a3e4e158f (0.1.5), where null-termination of r->uri and many other strings was removed. --- src/http/ngx_http_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 73ab204a2..d453b8a49 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -1230,7 +1230,7 @@ ngx_http_process_request_uri(ngx_http_request_t *r) r->uri.len++; } - r->uri.data = ngx_pnalloc(r->pool, r->uri.len + 1); + r->uri.data = ngx_pnalloc(r->pool, r->uri.len); if (r->uri.data == NULL) { ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return NGX_ERROR;