diff --git a/ChangeLog b/ChangeLog index 694518b00..3cb038fa9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * fix double free in disk cache * forward declaring libtorrent types is discouraged. a new fwd.hpp header is provided 1.1.3 release diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 10261aaf5..53af5431e 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -757,13 +757,13 @@ namespace libtorrent --pe->piece_refcount; iovec_flushed(pe, flushing, iov_len, 0, error, completed_jobs); + m_disk_cache.maybe_free_piece(pe); + // if the cache is under high pressure, we need to evict // the blocks we just flushed to make room for more write pieces int evict = m_disk_cache.num_to_evict(0); if (evict > 0) m_disk_cache.try_evict_blocks(evict); - m_disk_cache.maybe_free_piece(pe); - return iov_len; }