# HG changeset patch # User Maxim Dounin # Date 1316512846 0 # Node ID 70e1ee2307f9f7ac607c6d0e324f41116c794527 # Parent 6b9b7e7ac4a9b1287b755195bba3aed2f2d15e77 Fix of separate pool for upstream connections (r4117). Pool may not be created if connection was created but rejected in connect() call. Make sure to check if it is here before trying to destroy it. diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2922,7 +2922,10 @@ ngx_http_upstream_next(ngx_http_request_ } #endif - ngx_destroy_pool(u->peer.connection->pool); + if (u->peer.connection->pool) { + ngx_destroy_pool(u->peer.connection->pool); + } + ngx_close_connection(u->peer.connection); } @@ -3017,7 +3020,10 @@ ngx_http_upstream_finalize_request(ngx_h "close http upstream connection: %d", u->peer.connection->fd); - ngx_destroy_pool(u->peer.connection->pool); + if (u->peer.connection->pool) { + ngx_destroy_pool(u->peer.connection->pool); + } + ngx_close_connection(u->peer.connection); }