fix leak of peer_class objects (when setting per-torrent rate limits)

This commit is contained in:
arvidn 2017-10-03 01:48:19 +02:00 committed by Arvid Norberg
parent 85a179de9a
commit 99b19366a9
4 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,7 @@
1.1.5 release
* fix leak of peer_class objects (when setting per-torrent rate limits)
* expose peer_class API to python binding
* fix integer overflow in whole_pieces_threshold logic
* fix uTP path MTU discovery issue on windows (DF bit was not set correctly)

View File

@ -61,7 +61,7 @@ namespace libtorrent
{
boost::array<peer_class_t, 15>::iterator i = std::find(m_class.begin()
, m_class.begin() + m_size, c);
int idx = i - m_class.begin();
int const idx = i - m_class.begin();
if (idx == m_size) return; // not found
if (idx < m_size - 1)
{

View File

@ -1294,7 +1294,7 @@ namespace aux {
{
TORRENT_ASSERT(is_single_thread());
// if you hit this assert, you're deleting a non-existent peer class
TORRENT_ASSERT(m_classes.at(cid));
TORRENT_ASSERT_PRECOND(m_classes.at(cid));
if (m_classes.at(cid) == 0) return;
m_classes.decref(cid);
}
@ -1304,7 +1304,7 @@ namespace aux {
peer_class_info ret;
peer_class* pc = m_classes.at(cid);
// if you hit this assert, you're passing in an invalid cid
TORRENT_ASSERT(pc);
TORRENT_ASSERT_PRECOND(pc);
if (pc == 0)
{
#ifdef TORRENT_DEBUG
@ -1351,7 +1351,7 @@ namespace aux {
{
peer_class* pc = m_classes.at(cid);
// if you hit this assert, you're passing in an invalid cid
TORRENT_ASSERT(pc);
TORRENT_ASSERT_PRECOND(pc);
if (pc == 0) return;
pc->set_info(&pci);

View File

@ -4995,6 +4995,7 @@ namespace {
if (m_peer_class > 0)
{
remove_class(m_ses.peer_classes(), m_peer_class);
m_ses.peer_classes().decref(m_peer_class);
m_peer_class = 0;
}