Blobfs: add an assert for the memory allocation
Change-Id: Ie9c75206b61242c71ce6f4f408bbdd44f9633077 Signed-off-by: GangCao <gang.cao@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3998 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
3aaf8e0a0b
commit
4803dc36fc
@ -87,6 +87,7 @@ tree_insert_buffer(struct cache_tree *root, struct cache_buffer *buffer)
|
|||||||
while (offset >= CACHE_TREE_LEVEL_SIZE(root->level + 1)) {
|
while (offset >= CACHE_TREE_LEVEL_SIZE(root->level + 1)) {
|
||||||
if (root->present_mask != 0) {
|
if (root->present_mask != 0) {
|
||||||
tree = calloc(1, sizeof(*tree));
|
tree = calloc(1, sizeof(*tree));
|
||||||
|
assert(tree != NULL);
|
||||||
tree->level = root->level + 1;
|
tree->level = root->level + 1;
|
||||||
tree->u.tree[0] = root;
|
tree->u.tree[0] = root;
|
||||||
root = tree;
|
root = tree;
|
||||||
@ -103,6 +104,7 @@ tree_insert_buffer(struct cache_tree *root, struct cache_buffer *buffer)
|
|||||||
offset &= CACHE_TREE_LEVEL_MASK(tree->level);
|
offset &= CACHE_TREE_LEVEL_MASK(tree->level);
|
||||||
if (tree->u.tree[index] == NULL) {
|
if (tree->u.tree[index] == NULL) {
|
||||||
tree->u.tree[index] = calloc(1, sizeof(*tree));
|
tree->u.tree[index] = calloc(1, sizeof(*tree));
|
||||||
|
assert(tree->u.tree[index] != NULL);
|
||||||
tree->u.tree[index]->level = tree->level - 1;
|
tree->u.tree[index]->level = tree->level - 1;
|
||||||
tree->present_mask |= (1ULL << index);
|
tree->present_mask |= (1ULL << index);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user