comparison src/http/ngx_http_variables.c @ 5316:12dd27b74117

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.
author Valentin Bartenev <vbart@nginx.com>
date Tue, 06 Aug 2013 19:58:40 +0400
parents a64c8a5da336
children 6b479db5b52b
comparison
equal deleted inserted replaced
5315:31932b5464f0 5316:12dd27b74117
1372 == NULL) 1372 == NULL)
1373 { 1373 {
1374 return NGX_ERROR; 1374 return NGX_ERROR;
1375 } 1375 }
1376 1376
1377 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path, 0) != NGX_OK) { 1377 if (ngx_get_full_name(r->pool, (ngx_str_t *) &ngx_cycle->prefix, &path)
1378 != NGX_OK)
1379 {
1378 return NGX_ERROR; 1380 return NGX_ERROR;
1379 } 1381 }
1380 1382
1381 v->len = path.len; 1383 v->len = path.len;
1382 v->valid = 1; 1384 v->valid = 1;
1414 return NGX_ERROR; 1416 return NGX_ERROR;
1415 } 1417 }
1416 1418
1417 path.data[path.len - 1] = '\0'; 1419 path.data[path.len - 1] = '\0';
1418 1420
1419 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path, 0) != NGX_OK) { 1421 if (ngx_get_full_name(r->pool, (ngx_str_t *) &ngx_cycle->prefix, &path)
1422 != NGX_OK)
1423 {
1420 return NGX_ERROR; 1424 return NGX_ERROR;
1421 } 1425 }
1422 } 1426 }
1423 1427
1424 #if (NGX_HAVE_MAX_PATH) 1428 #if (NGX_HAVE_MAX_PATH)