* If get_cached_block() failed reading a block, it would leave a deleted object

in the unused list if it got the block via block_cache::_GetUnusedBlock().
* block_cache::_GetUnusedBlock() leaked the compare data block if the
  BLOCK_CACHE_DEBUG_CHANGED feature had been enabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35799 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-03-10 10:57:37 +00:00
parent 7794164d61
commit 47f23fb5c1
1 changed files with 10 additions and 6 deletions

View File

@ -1586,6 +1586,10 @@ block_cache::_GetUnusedBlock()
if (block->original_data != NULL)
Free(block->original_data);
#if BLOCK_CACHE_DEBUG_CHANGED
if (block->compare != NULL)
Free(block->compare);
#endif
return block;
}
@ -1809,6 +1813,12 @@ retry:
goto retry;
}
if (block->unused) {
//TRACE(("remove block %Ld from unused\n", blockNumber));
block->unused = false;
cache->unused_blocks.Remove(block);
}
if (*_allocated && readBlock) {
// read block into cache
int32 blockSize = cache->block_size;
@ -1833,12 +1843,6 @@ retry:
mark_block_unbusy_reading(cache, block);
}
if (block->unused) {
//TRACE(("remove block %Ld from unused\n", blockNumber));
block->unused = false;
cache->unused_blocks.Remove(block);
}
block->ref_count++;
block->last_accessed = system_time() / 1000000L;