Fix memory leak in advanced server examples

This commit is contained in:
Benjamin Roland Buch
2018-01-31 12:19:30 +01:00
committed by Vinnie Falco
parent cbcc034a70
commit 9f3c981d6a
3 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,9 @@
Version 155:
* Fix memory leak in advanced server examples
--------------------------------------------------------------------------------
Version 154:
* Type check completion handlers

View File

@ -26,6 +26,7 @@
#include <boost/asio/ssl/stream.hpp>
#include <boost/asio/strand.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/make_unique.hpp>
#include <boost/config.hpp>
#include <algorithm>
#include <cstdlib>
@ -745,7 +746,8 @@ class http_session
};
// Allocate and store the work
items_.emplace_back(new work_impl(self_, std::move(msg)));
items_.push_back(
boost::make_unique<work_impl>(self_, std::move(msg)));
// If there was no previous work, start this one
if(items_.size() == 1)

View File

@ -21,6 +21,7 @@
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/strand.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/make_unique.hpp>
#include <boost/config.hpp>
#include <algorithm>
#include <cstdlib>
@ -539,7 +540,8 @@ class http_session : public std::enable_shared_from_this<http_session>
};
// Allocate and store the work
items_.emplace_back(new work_impl(self_, std::move(msg)));
items_.push_back(
boost::make_unique<work_impl>(self_, std::move(msg)));
// If there was no previous work, start this one
if(items_.size() == 1)