comparison src/http/ngx_http_request.c @ 7753:2fec22332ff4

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 4e141d0816d4 f61d347158d0
comparison
equal deleted inserted replaced
7752:8989fbd2f89a 7753:2fec22332ff4
1228 1228
1229 if (r->empty_path_in_uri) { 1229 if (r->empty_path_in_uri) {
1230 r->uri.len++; 1230 r->uri.len++;
1231 } 1231 }
1232 1232
1233 r->uri.data = ngx_pnalloc(r->pool, r->uri.len + 1); 1233 r->uri.data = ngx_pnalloc(r->pool, r->uri.len);
1234 if (r->uri.data == NULL) { 1234 if (r->uri.data == NULL) {
1235 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 1235 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
1236 return NGX_ERROR; 1236 return NGX_ERROR;
1237 } 1237 }
1238 1238