aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_variables.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2013-08-06 19:58:40 +0400
committerValentin Bartenev <vbart@nginx.com>2013-08-06 19:58:40 +0400
commit3c5bd34771be032ef14e59f934058b3dce93588b (patch)
treea71e5b734bca4200959241d928410ba98f48070b /src/http/ngx_http_variables.c
parent1b7bc342186ff0768c06419a134032adb2a536f8 (diff)
downloadnginx-3c5bd34771be032ef14e59f934058b3dce93588b.tar.gz
nginx-3c5bd34771be032ef14e59f934058b3dce93588b.zip
Fixed memory leaks in the root and auth_basic_user_file directives.
If a relative path is set by variables, then the ngx_conf_full_name() function was called while processing requests, which causes allocations from the cycle pool. A new function that takes pool as an argument was introduced.
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r--src/http/ngx_http_variables.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index 0b1a33430..b4f8eeba0 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -1374,7 +1374,9 @@ ngx_http_variable_document_root(ngx_http_request_t *r,
return NGX_ERROR;
}
- if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path, 0) != NGX_OK) {
+ if (ngx_get_full_name(r->pool, (ngx_str_t *) &ngx_cycle->prefix, &path)
+ != NGX_OK)
+ {
return NGX_ERROR;
}
@@ -1416,7 +1418,9 @@ ngx_http_variable_realpath_root(ngx_http_request_t *r,
path.data[path.len - 1] = '\0';
- if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path, 0) != NGX_OK) {
+ if (ngx_get_full_name(r->pool, (ngx_str_t *) &ngx_cycle->prefix, &path)
+ != NGX_OK)
+ {
return NGX_ERROR;
}
}