forked from premiere/premiere-libtorrent
fixed memory leak in disk cache
This commit is contained in:
parent
6242ae051e
commit
3ea52b240f
|
@ -70,6 +70,7 @@ release 0.14.4
|
||||||
* fixed bug when checking a torrent twice
|
* fixed bug when checking a torrent twice
|
||||||
* improved handling of out-of-memory conditions in disk I/O thread
|
* improved handling of out-of-memory conditions in disk I/O thread
|
||||||
* fixed bug when force-checking a torrent with partial pieces
|
* fixed bug when force-checking a torrent with partial pieces
|
||||||
|
* fixed memory leak in disk cache
|
||||||
|
|
||||||
release 0.14.3
|
release 0.14.3
|
||||||
|
|
||||||
|
|
|
@ -897,7 +897,7 @@ namespace libtorrent
|
||||||
std::memset(&p.blocks[0], 0, blocks_in_piece * sizeof(char*));
|
std::memset(&p.blocks[0], 0, blocks_in_piece * sizeof(char*));
|
||||||
int ret = read_into_piece(p, 0, ignore_cache_size, INT_MAX, l);
|
int ret = read_into_piece(p, 0, ignore_cache_size, INT_MAX, l);
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret < 0)
|
||||||
free_piece(p, l);
|
free_piece(p, l);
|
||||||
else
|
else
|
||||||
m_read_pieces.push_back(p);
|
m_read_pieces.push_back(p);
|
||||||
|
@ -936,7 +936,7 @@ namespace libtorrent
|
||||||
std::memset(&p.blocks[0], 0, blocks_in_piece * sizeof(char*));
|
std::memset(&p.blocks[0], 0, blocks_in_piece * sizeof(char*));
|
||||||
int ret = read_into_piece(p, start_block, 0, blocks_to_read, l);
|
int ret = read_into_piece(p, start_block, 0, blocks_to_read, l);
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret < 0)
|
||||||
free_piece(p, l);
|
free_piece(p, l);
|
||||||
else
|
else
|
||||||
m_read_pieces.push_back(p);
|
m_read_pieces.push_back(p);
|
||||||
|
@ -1421,6 +1421,9 @@ namespace libtorrent
|
||||||
// reading and hashing, not for keeping it around)
|
// reading and hashing, not for keeping it around)
|
||||||
sha1_hash h;
|
sha1_hash h;
|
||||||
ret = read_piece_from_cache_and_hash(j, h);
|
ret = read_piece_from_cache_and_hash(j, h);
|
||||||
|
|
||||||
|
// -2 means there's no space in the read cache
|
||||||
|
// or that the read cache is disabled
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
test_error(j);
|
test_error(j);
|
||||||
|
|
Loading…
Reference in New Issue