summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_http_proxy.c')
-rw-r--r--src/nxt_http_proxy.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nxt_http_proxy.c b/src/nxt_http_proxy.c
index 6aa3aabb..7f6ad686 100644
--- a/src/nxt_http_proxy.c
+++ b/src/nxt_http_proxy.c
@@ -381,9 +381,10 @@ nxt_http_proxy_error(nxt_task_t *task, void *obj, void *data)
r = obj;
peer = r->peer;
- nxt_http_proto[peer->protocol].peer_close(task, peer);
-
- nxt_mp_release(r->mem_pool);
+ if (!peer->closed) {
+ nxt_http_proto[peer->protocol].peer_close(task, peer);
+ nxt_mp_release(r->mem_pool);
+ }
nxt_http_request_error(&r->task, r, peer->status);
}