cache_abort_transaction() could let cached_block::parent_data have the same value

as cached_block::data - which led to a crash as block_cache::FreeBlock() tried to
free both later.
Since neither cached_block::parent_data nor cached_block::original are supposed
to be != NULL in block_cache::FreeBlock(), they are no longer freed, but the system
panics if one of them is not NULL.
This should fix bug #77.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15749 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-12-30 18:47:16 +00:00
parent c77be36230
commit 140dd51293
2 changed files with 6 additions and 5 deletions

View File

@ -9,7 +9,6 @@
#include <KernelExport.h>
#include <util/AutoLock.h>
//#include <vm.h>
#include <vm_address_space.h>
#include <vm_page.h>

View File

@ -264,8 +264,9 @@ block_cache::FreeBlock(cached_block *block)
ASSERT(range != NULL);
range->Free(this, block);
Free(block->original);
Free(block->parent_data);
if (block->original != NULL || block->parent_data != NULL)
panic("block_cache::FreeBlock(): %p, %p\n", block->original, block->parent_data);
#ifdef DEBUG_CHANGED
Free(block->compare);
#endif
@ -804,8 +805,9 @@ cache_abort_transaction(void *_cache, int32 id)
cache->Free(block->original);
block->original = NULL;
}
if (transaction->has_sub_transaction && block->parent_data != block->data) {
cache->Free(block->parent_data);
if (transaction->has_sub_transaction) {
if (block->parent_data != block->data)
cache->Free(block->parent_data);
block->parent_data = NULL;
}