changeset 2556:8ec97ff12a0a

fix segfaults introduced in r2549 and r2550
author Igor Sysoev <igor@sysoev.ru>
date Wed, 11 Mar 2009 13:04:02 +0000
parents 0408f34ef7ea
children c4a56c197eea
files src/http/ngx_http_core_module.c src/http/ngx_http_request.c
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1380,9 +1380,9 @@ ngx_http_core_find_location(ngx_http_req
 
             if ((*clcfp)->captures && r->captures == NULL) {
 
-                len = (NGX_HTTP_MAX_CAPTURES + 1) * 3 * sizeof(int);
-
-                r->captures = ngx_palloc(r->pool, len);
+                len = (NGX_HTTP_MAX_CAPTURES + 1) * 3;
+
+                r->captures = ngx_palloc(r->pool, len * sizeof(int));
                 if (r->captures == NULL) {
                     return NGX_ERROR;
                 }
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1662,9 +1662,9 @@ ngx_http_find_virtual_server(ngx_http_re
 
             if (sn[i].captures && r->captures == NULL) {
 
-                ncaptures = (NGX_HTTP_MAX_CAPTURES + 1) * 3 * sizeof(int);
-
-                r->captures = ngx_palloc(r->pool, ncaptures);
+                ncaptures = (NGX_HTTP_MAX_CAPTURES + 1) * 3;
+
+                r->captures = ngx_palloc(r->pool, ncaptures * sizeof(int));
                 if (r->captures == NULL) {
                     return NGX_ERROR;
                 }