From ebc7fc67c88790a475eaaa3f6d650ca81012ed16 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Thu, 7 Jul 2016 13:45:06 +0100 Subject: 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. --- libdm/libdm-stats.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c index 9b55813db..46495c31d 100644 --- a/libdm/libdm-stats.c +++ b/libdm/libdm-stats.c @@ -1980,7 +1980,6 @@ static int _stats_remove_region_id_from_group(struct dm_stats *dms, /* removing group leader? */ if (region_id == group_id) { - dms->groups[group_id].group_id = DM_STATS_GROUP_NOT_PRESENT; _stats_clear_group_regions(dms, group_id); _stats_group_destroy(&dms->groups[group_id]); } -- cgit v1.2.1