comparison src/http/ngx_http_request.c @ 5082:42a888fdad0b

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 Valentin Bartenev <vbart@nginx.com>
date Sat, 23 Feb 2013 13:23:48 +0000
parents 7fa7e60a7f66
children f7fe817c92a2
comparison
equal deleted inserted replaced
5081:bebcc2f837d3 5082:42a888fdad0b
2756 c->log_error = NGX_ERROR_INFO; 2756 c->log_error = NGX_ERROR_INFO;
2757 2757
2758 if (n == NGX_AGAIN) { 2758 if (n == NGX_AGAIN) {
2759 if (ngx_handle_read_event(rev, 0) != NGX_OK) { 2759 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
2760 ngx_http_close_connection(c); 2760 ngx_http_close_connection(c);
2761 return;
2761 } 2762 }
2762 2763
2763 /* 2764 /*
2764 * Like ngx_http_set_keepalive() we are trying to not hold 2765 * Like ngx_http_set_keepalive() we are trying to not hold
2765 * c->buffer's memory for a keepalive connection. 2766 * c->buffer's memory for a keepalive connection.