summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_h1proto.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-09-30 16:36:57 +0300
committerMax Romanov <max.romanov@nginx.com>2020-09-30 16:36:57 +0300
commitc5cb2432c473a00a8af69b8930b268552afce85b (patch)
treed2a08364444550a4ff9ef66d07913f16aa56ea54 /src/nxt_h1proto.c
parent153e8a87792ecc5dee12ba1f261fe1340a800a90 (diff)
downloadunit-c5cb2432c473a00a8af69b8930b268552afce85b.tar.gz
unit-c5cb2432c473a00a8af69b8930b268552afce85b.tar.bz2
Fixing router connection pool leakage.
The connection's local socket address is allocated from the connection pool before the request is passed to the application; however, with keep-alive connections, this field was unconditionally reset by a socket configuration value that could be NULL. For the next request, the address was allocated again from the same connection pool. Nonetheless, all leaked addresses were released when the connection was closed. The issue introduced in changeset 5c7dd85fabd5.
Diffstat (limited to 'src/nxt_h1proto.c')
-rw-r--r--src/nxt_h1proto.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c
index 7c695549..dc23d7c4 100644
--- a/src/nxt_h1proto.c
+++ b/src/nxt_h1proto.c
@@ -503,7 +503,10 @@ nxt_h1p_conn_request_init(nxt_task_t *task, void *obj, void *data)
joint->count++;
r->conf = joint;
- c->local = joint->socket_conf->sockaddr;
+
+ if (c->local == NULL) {
+ c->local = joint->socket_conf->sockaddr;
+ }
nxt_h1p_conn_request_header_parse(task, c, h1p);
return;