changeset 7753:2fec22332ff4 default tip

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 10 Dec 2020 20:09:39 +0300
parents 8989fbd2f89a
children
files src/http/ngx_http_request.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_request.c	Thu Dec 10 20:09:30 2020 +0300
+++ b/src/http/ngx_http_request.c	Thu Dec 10 20:09:39 2020 +0300
@@ -1230,7 +1230,7 @@
             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;