summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2011-09-20 10:00:46 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2011-09-20 10:00:46 +0000
commitafe2e3d082c5b6501d0107d86ecdfff36f458b85 (patch)
tree7a69a354102ed440f567ec0472094be94c2b9ebc
parent265e51aa0b65fe8ba456224b95659b2612e0fc6d (diff)
downloadnginx-afe2e3d082c5b6501d0107d86ecdfff36f458b85.tar.gz
nginx-afe2e3d082c5b6501d0107d86ecdfff36f458b85.tar.bz2
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.
-rw-r--r--src/http/ngx_http_upstream.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index d3d433b24..ef16a662c 100644
--- 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_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);
}