lvm2/0016-stats-fix-error-path-when-region-is-NULL.patch
2020-07-02 10:41:52 +08:00

52 lines
1.3 KiB
Diff

From ebb978b547c4593de34d259e745824f12672614d Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Wed, 13 Mar 2019 14:46:45 +0800
Subject: [PATCH 15/17] stats: fix error path when region is NULL
We should not call _stats_cleanup_region_ids() when regions
are NULL.
Also add backtracing for goto.
(cherry picked from commit 3750b0cff5ab1c41076afdf8275e3fa20aa756d0)
---
libdm/libdm-stats.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 6b4e3d8..ec9801a 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4867,24 +4867,24 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
group_id, &count, &regroup);
if (!regions)
- goto bad;
+ goto_out;
if (!dm_stats_list(dms, NULL))
- goto bad;
+ goto_bad;
/* regroup if there are regions to group */
if (regroup && (*regions != DM_STATS_REGION_NOT_PRESENT))
if (!_stats_group_file_regions(dms, regions, count, alias))
- goto bad;
+ goto_bad;
dm_free(bounds);
dm_free((char *) alias);
return regions;
bad:
_stats_cleanup_region_ids(dms, regions, count);
- dm_free(bounds);
- dm_free(regions);
out:
+ dm_free(regions);
+ dm_free(bounds);
dm_free((char *) alias);
return NULL;
}
--
2.19.1