mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: fix group resource leak in dm_stats_delete_region()
The function _stats_remove_region_id_from_group() incorecctly set the group_id to DM_STATS_GROUP_NOT_PRESENT _before_ the call to _stats_group_destroy(). This will cause the destroy function to return immediately without doing anything: 339 static void _stats_group_destroy(struct dm_stats_group *group) 340 { 341 if (!_stats_group_present(group)) 342 return; Invalidating the ID in _stats_region_region_id_from_group() is redundant anyway; it is rightly done as the last operation in _stats_group_destroy (and it is not possible for anything to see the old value between the two calls). Remove the change to group_id to ensure that the alias and bitset resources are correctly freed.
This commit is contained in:
parent
005adb0a0a
commit
ebc7fc67c8
@ -1980,7 +1980,6 @@ static int _stats_remove_region_id_from_group(struct dm_stats *dms,
|
|||||||
|
|
||||||
/* removing group leader? */
|
/* removing group leader? */
|
||||||
if (region_id == group_id) {
|
if (region_id == group_id) {
|
||||||
dms->groups[group_id].group_id = DM_STATS_GROUP_NOT_PRESENT;
|
|
||||||
_stats_clear_group_regions(dms, group_id);
|
_stats_clear_group_regions(dms, group_id);
|
||||||
_stats_group_destroy(&dms->groups[group_id]);
|
_stats_group_destroy(&dms->groups[group_id]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user