1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

raid: destroy allocation handle on error path

Don't leak ah memory pool on error path.
This commit is contained in:
Zdenek Kabelac 2014-09-12 11:37:01 +02:00
parent 76c3c94bd2
commit 08914ed7c1
2 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.112 - Version 2.02.112 -
===================================== =====================================
Don't leak alloc_handle on raid target error path.
Properly validate raid leg names. Properly validate raid leg names.
Archive metadata before starting their modification in raid target. Archive metadata before starting their modification in raid target.
Add missing vg_revert in suspend_lv() error path in raid target. Add missing vg_revert in suspend_lv() error path in raid target.

View File

@ -459,15 +459,17 @@ static int _alloc_image_components(struct logical_volume *lv,
* from 's + count'. * from 's + count'.
*/ */
if (!(lvl_array[s + count].lv = if (!(lvl_array[s + count].lv =
_alloc_image_component(lv, NULL, ah, s + count, RAID_META))) _alloc_image_component(lv, NULL, ah, s + count, RAID_META))) {
alloc_destroy(ah);
return_0; return_0;
}
dm_list_add(new_meta_lvs, &(lvl_array[s + count].list)); dm_list_add(new_meta_lvs, &(lvl_array[s + count].list));
if (!(lvl_array[s].lv = if (!(lvl_array[s].lv =
_alloc_image_component(lv, NULL, ah, s, RAID_IMAGE))) _alloc_image_component(lv, NULL, ah, s, RAID_IMAGE))) {
alloc_destroy(ah);
return_0; return_0;
}
dm_list_add(new_data_lvs, &(lvl_array[s].list)); dm_list_add(new_data_lvs, &(lvl_array[s].list));
} }
@ -517,8 +519,10 @@ static int _alloc_rmeta_for_lv(struct logical_volume *data_lv,
&allocatable_pvs, data_lv->alloc, 0, NULL))) &allocatable_pvs, data_lv->alloc, 0, NULL)))
return_0; return_0;
if (!(*meta_lv = _alloc_image_component(data_lv, base_name, ah, 0, RAID_META))) if (!(*meta_lv = _alloc_image_component(data_lv, base_name, ah, 0, RAID_META))) {
alloc_destroy(ah);
return_0; return_0;
}
alloc_destroy(ah); alloc_destroy(ah);