From: Marcin Siodelski Date: Wed, 24 May 2017 15:05:56 +0000 (+0200) Subject: [5261] Eliminated valgrind errors in libkea-http. X-Git-Tag: trac5286_base~7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07d85808c0c37d08ca9605d63c0b9c9d26b8942d;p=thirdparty%2Fkea.git [5261] Eliminated valgrind errors in libkea-http. --- diff --git a/src/lib/http/connection.cc b/src/lib/http/connection.cc index 6944bf2b37..1e5f5cb2ec 100644 --- a/src/lib/http/connection.cc +++ b/src/lib/http/connection.cc @@ -148,8 +148,12 @@ HttpConnection::acceptorCallback(const boost::system::error_code& ec) { HTTP_REQUEST_RECEIVE_START) .arg(getRemoteEndpointAddressAsText()) .arg(static_cast(request_timeout_/1000)); + // Pass raw pointer rather than shared_ptr to this object, + // because IntervalTimer already passes shared pointer to the + // IntervalTimerImpl to make sure that the callback remains + // valid. request_timer_.setup(boost::bind(&HttpConnection::requestTimeoutCallback, - shared_from_this()), + this), request_timeout_, IntervalTimer::ONE_SHOT); doRead(); } diff --git a/src/lib/http/connection_pool.cc b/src/lib/http/connection_pool.cc index e5a7b5d2af..8d39c02d4d 100644 --- a/src/lib/http/connection_pool.cc +++ b/src/lib/http/connection_pool.cc @@ -19,6 +19,7 @@ HttpConnectionPool::start(const HttpConnectionPtr& connection) { void HttpConnectionPool::stop(const HttpConnectionPtr& connection) { connections_.remove(connection); + connection->close(); } void