fixed disk buffer leak in smart_ban extension
This commit is contained in:
parent
6858a29b83
commit
f4427a582a
|
@ -87,6 +87,7 @@ release 0.14.6
|
||||||
* added --with-libgeoip option to configure script to allow building and
|
* added --with-libgeoip option to configure script to allow building and
|
||||||
linking against system wide library
|
linking against system wide library
|
||||||
* fixed potential pure virtual function call in extensions on shutdown
|
* fixed potential pure virtual function call in extensions on shutdown
|
||||||
|
* fixed disk buffer leak in smart_ban extension
|
||||||
|
|
||||||
release 0.14.5
|
release 0.14.5
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,10 @@ namespace libtorrent { namespace
|
||||||
|
|
||||||
void on_read_failed_block(piece_block b, address a, int ret, disk_io_job const& j)
|
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
|
// ignore read errors
|
||||||
if (ret != j.buffer_size) return;
|
if (ret != j.buffer_size) return;
|
||||||
|
|
||||||
|
@ -172,10 +176,6 @@ namespace libtorrent { namespace
|
||||||
crc.update(j.buffer, j.buffer_size);
|
crc.update(j.buffer, j.buffer_size);
|
||||||
crc.update((char const*)&m_salt, sizeof(m_salt));
|
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
|
std::pair<policy::iterator, policy::iterator> range
|
||||||
= m_torrent.get_policy().find_peers(a);
|
= 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)
|
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);
|
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
|
// ignore read errors
|
||||||
if (ret != j.buffer_size) return;
|
if (ret != j.buffer_size) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue