]> git.kaiwu.me - nginx.git/commitdiff
Fix of separate pool for upstream connections (r4117).
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 20 Sep 2011 10:00:46 +0000 (10:00 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 20 Sep 2011 10:00:46 +0000 (10:00 +0000)
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.

src/http/ngx_http_upstream.c

index d3d433b240c2dcd0874c56bb0d862bb172488722..ef16a662c7c5bc584d7b825aa69448f609858bca 100644 (file)
@@ -2922,7 +2922,10 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
         }
 #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_http_request_t *r,
                        "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);
     }