changeset 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 0dbe5eaa2388
children 2bdb94e65a4c
files src/http/ngx_http_request.c
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -2743,6 +2743,7 @@ ngx_http_keepalive_handler(ngx_event_t *
     if (n == NGX_AGAIN) {
         if (ngx_handle_read_event(rev, 0) != NGX_OK) {
             ngx_http_close_connection(c);
+            return;
         }
 
         /*