diff --git a/ChangeLog b/ChangeLog index b3157c422..65b1f357e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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) diff --git a/src/peer_class_set.cpp b/src/peer_class_set.cpp index 65f7ca8f3..1606608ab 100644 --- a/src/peer_class_set.cpp +++ b/src/peer_class_set.cpp @@ -61,7 +61,7 @@ namespace libtorrent { boost::array::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) { diff --git a/src/session_impl.cpp b/src/session_impl.cpp index f8f5bd736..9bc81567b 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -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); diff --git a/src/torrent.cpp b/src/torrent.cpp index dba9322af..a89750050 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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; }