changeset 2566:5e7d590cd704

fix case when regex locaiton runs the second time via internal redirect
author Igor Sysoev <igor@sysoev.ru>
date Sat, 14 Mar 2009 19:24:17 +0000
parents 456e453eb84a
children f0f64973ba2f
files src/http/ngx_http_core_module.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1378,13 +1378,15 @@ ngx_http_core_find_location(ngx_http_req
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                            "test location: ~ \"%V\"", &(*clcfp)->name);
 
-            if ((*clcfp)->captures && r->captures == NULL) {
+            if ((*clcfp)->captures) {
 
                 len = (NGX_HTTP_MAX_CAPTURES + 1) * 3;
 
-                r->captures = ngx_palloc(r->pool, len * sizeof(int));
                 if (r->captures == NULL) {
-                    return NGX_ERROR;
+                    r->captures = ngx_palloc(r->pool, len * sizeof(int));
+                    if (r->captures == NULL) {
+                        return NGX_ERROR;
+                    }
                 }
             }