Commit 25a6596e authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Call Http2Session::disconnect() if initiate_connection() failed

This will clean up resources allocated in initiate_connection()
properly.
parent 87216312
......@@ -156,6 +156,7 @@ void notify_readcb(bufferevent *bev, void *arg)
if(rv != 0) {
SSLOG(FATAL, http2session)
<< "Could not initiate backend connection";
http2session->disconnect();
}
break;
case Http2Session::CONNECTED:
......@@ -389,8 +390,6 @@ int Http2Session::initiate_connection()
SSLOG(ERROR, this) << "Failed to connect to the proxy "
<< get_config()->downstream_http_proxy_host << ":"
<< get_config()->downstream_http_proxy_port;
bufferevent_free(bev_);
bev_ = nullptr;
return SHRPX_ERR_NETWORK;
}
proxy_htp_ = util::make_unique<http_parser>();
......@@ -432,7 +431,6 @@ int Http2Session::initiate_connection()
BEV_OPT_DEFER_CALLBACKS);
if(!bev_) {
SSLOG(ERROR, this) << "bufferevent_socket_new() failed";
SSL_free(ssl_);
return SHRPX_ERR_NETWORK;
}
rv = bufferevent_socket_connect
......@@ -468,8 +466,6 @@ int Http2Session::initiate_connection()
}
}
if(rv != 0) {
bufferevent_free(bev_);
bev_ = nullptr;
return SHRPX_ERR_NETWORK;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment