1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-17 06:04:23 +03:00

cleanup: simplify error path code

Mempool needs to free only with first alllocated element,
everything allocated afterwards is released as well.
This commit is contained in:
Zdenek Kabelac 2015-02-19 14:06:17 +01:00
parent 4c184e9d6b
commit a18d789684

View File

@ -460,7 +460,7 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
if (!(*layout = str_list_create(mem))) {
log_error("LV layout list allocation failed");
goto bad;
return 0;
}
if (!(*role = str_list_create(mem))) {
@ -549,10 +549,8 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
return 1;
bad:
if (*role)
dm_pool_free(mem, *role);
if (*layout)
dm_pool_free(mem, *layout);
return 0;
}