comparison src/http/ngx_http_request.c @ 5154:7f141f99f1cd stable-1.2

Merge of r5083: fixed potential segfault in keepalive handler. Fixed potential segfault in ngx_http_keepalive_handler(). In case of error in the read event handling we close a connection by calling ngx_http_close_connection(), that also destroys connection pool. Thereafter, an attempt to free a buffer (added in r4892) that was allocated from the pool could cause SIGSEGV and is meaningless as well (the buffer already freed with the pool).
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 29 Mar 2013 17:19:11 +0000
parents 01d3d3a185e9
children
comparison
equal deleted inserted replaced
5153:0dbe5eaa2388 5154:7f141f99f1cd
2741 c->log_error = NGX_ERROR_INFO; 2741 c->log_error = NGX_ERROR_INFO;
2742 2742
2743 if (n == NGX_AGAIN) { 2743 if (n == NGX_AGAIN) {
2744 if (ngx_handle_read_event(rev, 0) != NGX_OK) { 2744 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
2745 ngx_http_close_connection(c); 2745 ngx_http_close_connection(c);
2746 return;
2746 } 2747 }
2747 2748
2748 /* 2749 /*
2749 * Like ngx_http_set_keepalive() we are trying to not hold 2750 * Like ngx_http_set_keepalive() we are trying to not hold
2750 * c->buffer's memory for a keepalive connection. 2751 * c->buffer's memory for a keepalive connection.