{
DPRINT1("Filesystem corruption detected!\n");
DestroyBTree(Tree);
- return STATUS_FILE_CORRUPT_ERROR;
+ Status = STATUS_FILE_CORRUPT_ERROR;
+ goto Cleanup;
}
// Start at the first node entry
{
DPRINT1("ERROR: Couldn't allocate memory for next key!\n");
DestroyBTree(Tree);
- return STATUS_INSUFFICIENT_RESOURCES;
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto Cleanup;
}
RootNode->KeyCount++;
{
DPRINT1("ERROR: Couldn't allocate memory for next key!\n");
DestroyBTree(Tree);
- return STATUS_INSUFFICIENT_RESOURCES;
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ goto Cleanup;
}
RtlZeroMemory(NextKey, sizeof(B_TREE_KEY));
{
DPRINT1("ERROR: Couldn't create child node!\n");
DestroyBTree(Tree);
- return STATUS_NOT_IMPLEMENTED;
+ Status = STATUS_NOT_IMPLEMENTED;
+ goto Cleanup;
}
}
{
DPRINT1("ERROR: Couldn't create child node!\n");
DestroyBTree(Tree);
- return STATUS_NOT_IMPLEMENTED;
+ Status = STATUS_NOT_IMPLEMENTED;
+ goto Cleanup;
}
}
}
*NewTree = Tree;
+ Status = STATUS_SUCCESS;
+Cleanup:
if (IndexAllocationContext)
ReleaseAttributeContext(IndexAllocationContext);
- return STATUS_SUCCESS;
+ return Status;
}
/**
if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Failed to add index bitmap!\n");
+ ReleaseAttributeContext(IndexAllocationContext);
return Status;
}
#endif
return STATUS_SUCCESS;
-}
\ No newline at end of file
+}