Skip to content

Commit

Permalink
bfs: Fixed removing a listener that was never added.
Browse files Browse the repository at this point in the history
* When the tree constructor failed, the InodeAllocator would try to remove
  the tree from the transaction. However, in that case, it was never added
  to it.
* Inode::fTree is no longer set if the tree constructor failed.
* This fixes bug #10089.
  • Loading branch information
axeld committed Oct 14, 2013
1 parent 45a5246 commit aeee1f7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/add-ons/kernel/file_systems/bfs/Inode.cpp
Expand Up @@ -236,11 +236,18 @@ InodeAllocator::CreateTree()
if ((fInode->Mode() & S_INDEX_TYPES) == 0)
fInode->Node().mode |= HOST_ENDIAN_TO_BFS_INT32(S_STR_INDEX);

BPlusTree* tree = fInode->fTree
= new(std::nothrow) BPlusTree(*fTransaction, fInode);
if (tree == NULL || tree->InitCheck() < B_OK)
BPlusTree* tree = new(std::nothrow) BPlusTree(*fTransaction, fInode);
if (tree == NULL)
return B_ERROR;

status_t status = tree->InitCheck();
if (status != B_OK) {
delete tree;
return status;
}

fInode->fTree = tree;

if (fInode->IsRegularNode()) {
if (tree->Insert(*fTransaction, ".", fInode->ID()) < B_OK
|| tree->Insert(*fTransaction, "..",
Expand Down

0 comments on commit aeee1f7

Please sign in to comment.