fixed disk buffer leak in smart_ban extension

This commit is contained in:
Arvid Norberg 2009-09-14 17:07:39 +00:00
parent 6858a29b83
commit f4427a582a
2 changed files with 7 additions and 6 deletions

View File

@ -87,6 +87,7 @@ release 0.14.6
* added --with-libgeoip option to configure script to allow building and
linking against system wide library
* fixed potential pure virtual function call in extensions on shutdown
* fixed disk buffer leak in smart_ban extension
release 0.14.5

View File

@ -165,6 +165,10 @@ namespace libtorrent { namespace
void on_read_failed_block(piece_block b, address a, int ret, disk_io_job const& j)
{
aux::session_impl::mutex_t::scoped_lock l(m_torrent.session().m_mutex);
disk_buffer_holder buffer(m_torrent.session(), j.buffer);
// ignore read errors
if (ret != j.buffer_size) return;
@ -172,10 +176,6 @@ namespace libtorrent { namespace
crc.update(j.buffer, j.buffer_size);
crc.update((char const*)&m_salt, sizeof(m_salt));
// since this callback is called directory from the disk io
// thread, the session mutex is not locked when we get here
aux::session_impl::mutex_t::scoped_lock l(m_torrent.session().m_mutex);
std::pair<policy::iterator, policy::iterator> range
= m_torrent.get_policy().find_peers(a);
@ -246,10 +246,10 @@ namespace libtorrent { namespace
void on_read_ok_block(std::pair<piece_block, block_entry> b, int ret, disk_io_job const& j)
{
// since this callback is called directory from the disk io
// thread, the session mutex is not locked when we get here
aux::session_impl::mutex_t::scoped_lock l(m_torrent.session().m_mutex);
disk_buffer_holder buffer(m_torrent.session(), j.buffer);
// ignore read errors
if (ret != j.buffer_size) return;