nghttpx: Fix memory leak

This commit is contained in:
Tatsuhiro Tsujikawa 2016-06-06 00:16:25 +09:00
parent 7751f4fb3b
commit ac97c122d4
1 changed files with 8 additions and 6 deletions

View File

@ -182,27 +182,29 @@ void Worker::replace_downstream_config(
dst_addr.fall = src_addr.fall;
dst_addr.rise = src_addr.rise;
auto shared_addr_ptr = shared_addr.get();
dst_addr.connect_blocker =
make_unique<ConnectBlocker>(randgen_, loop_,
[shared_addr, &dst_addr]() {
[shared_addr_ptr, &dst_addr]() {
switch (dst_addr.proto) {
case PROTO_HTTP1:
--shared_addr->http1_pri.weight;
--shared_addr_ptr->http1_pri.weight;
break;
case PROTO_HTTP2:
--shared_addr->http2_pri.weight;
--shared_addr_ptr->http2_pri.weight;
break;
default:
assert(0);
}
},
[shared_addr, &dst_addr]() {
[shared_addr_ptr, &dst_addr]() {
switch (dst_addr.proto) {
case PROTO_HTTP1:
++shared_addr->http1_pri.weight;
++shared_addr_ptr->http1_pri.weight;
break;
case PROTO_HTTP2:
++shared_addr->http2_pri.weight;
++shared_addr_ptr->http2_pri.weight;
break;
default:
assert(0);