[PATCH] http_request: fix a segmentation fault
Kirill A. Korinskiy
catap at catap.ru
Tue May 26 22:31:42 MSD 2009
If ngx_list_init/ngx_pcalloc/ngx_pcalloc return a NGX_ERROR nginx have
a segmentation fault, because r->main and r->variables have a NULL
---
src/http/ngx_http_request.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index c9c6db7..b737497 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -449,13 +449,15 @@ ngx_http_init_request(ngx_event_t *rev)
sizeof(ngx_table_elt_t))
!= NGX_OK)
{
- ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ ngx_http_close_connection(c);
+ ngx_destroy_pool(r->pool);
return;
}
r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
if (r->ctx == NULL) {
- ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ ngx_http_close_connection(c);
+ ngx_destroy_pool(r->pool);
return;
}
@@ -464,7 +466,8 @@ ngx_http_init_request(ngx_event_t *rev)
r->variables = ngx_pcalloc(r->pool, cmcf->variables.nelts
* sizeof(ngx_http_variable_value_t));
if (r->variables == NULL) {
- ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ ngx_http_close_connection(c);
+ ngx_destroy_pool(r->pool);
return;
}
--
1.6.2
--Multipart_Wed_May_27_02:19:43_2009-1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
> p.s. Content-Type application/octet-stream Ð´Ð»Ñ Ð¿Ð°ÑÑа - ÑÑо
> Ñ
оÑоÑий, пÑавилÑнÑй вÑбоÑ. ÐадаÑа ÑÑоÑла "ÑÑÐ¾Ð±Ñ Ð½Ð¸ÐºÑо не
> пÑоÑиÑал"? :)
>
Ðга. ТолÑко Ñ Ð¾ÑибÑÑ Ð¸ вмеÑÑо md5sum паÑÑ ÑÑнÑл Ñ ÐºÑивÑм
content-type. Ð ÑледÑÑÑий Ñаз не бÑÐ´Ñ Ð´Ð¾Ð¿ÑÑкаÑÑ Ð¿Ð¾Ð´Ð¾Ð±Ð½ÑÑ
оÑибок и
Ð¿Ð¾Ð·Ð²Ð¾Ð»Ñ Ð²Ð°Ð¼ Ð²Ð´Ð¾Ð²Ð¾Ð»Ñ Ð¿ÑоÑвиÑÑ ÑÐ²Ð¾Ñ ÑанÑÐ°Ð·Ð¸Ñ :)
--
wbr, Kirill
--Multipart_Wed_May_27_02:19:43_2009-1--
More information about the nginx-ru
mailing list