get_cached_block(): Remove the newly allocated block from the

hashtable in case of a read error (NewBlock() also adds the block,
but FreeBlock() only frees it).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20365 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-03-11 13:51:18 +00:00
parent 6e601ee88f
commit e1555e1fdf
+1
View File
@@ -505,6 +505,7 @@ get_cached_block(block_cache *cache, off_t blockNumber, bool *allocated, bool re
int32 blockSize = cache->block_size;
if (read_pos(cache->fd, blockNumber * blockSize, block->current_data, blockSize) < blockSize) {
hash_remove(cache->hash, block);
cache->FreeBlock(block);
FATAL(("could not read block %Ld\n", blockNumber));
return NULL;