mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-09 12:58:41 +03:00
o Fixed code where return value of vmalloc wasn't checked
This commit is contained in:
parent
bd28d06298
commit
f1571e2d46
@ -110,8 +110,8 @@ struct dm_table *dm_parse(extract_line_fn line_fn, void *l_private,
|
||||
#undef PARSE_ERROR
|
||||
|
||||
if (!was_error) {
|
||||
dm_table_complete(table);
|
||||
return table;
|
||||
if (dm_table_complete(table) == 0)
|
||||
return table;
|
||||
}
|
||||
|
||||
dm_table_destroy(table);
|
||||
|
@ -214,9 +214,17 @@ int dm_table_complete(struct dm_table *t)
|
||||
for (i = t->depth - 2; i >= 0; i--) {
|
||||
t->counts[i] = div_up(t->counts[i + 1], CHILDREN_PER_NODE);
|
||||
t->index[i] = vmalloc(NODE_SIZE * t->counts[i]);
|
||||
if (!t->index[i])
|
||||
goto free_indices;
|
||||
setup_btree_index(i, t);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
free_indices:
|
||||
for(++i; i < t->depth - 1; i++) {
|
||||
vfree(t->index[i]);
|
||||
}
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user