From e1555e1fdf435cda7477ae521b0953b12c623304 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 11 Mar 2007 13:51:18 +0000 Subject: [PATCH] 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 --- src/system/kernel/cache/block_cache.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index ee3009d123..4eb5facdb1 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -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;