Skip to contentSkip to conversation

stable-2.02 - stats: fix error path when region is NULL

PATCH Marian Csontos 1 participant 1 message Mar 5, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8fc64c5ee67c90ac33df657ec514216ce2a804b9
Commit:        8fc64c5ee67c90ac33df657ec514216ce2a804b9
Parent:        8d44cd3e47a05db4983bcb8e8e1c08cfe80708ab
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Dec 21 20:12:40 2018 +0100
Committer:     Marian Csontos <[email protected]>
CommitterDate: Tue Mar 5 12:57:40 2019 +0100

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 files changed, 5 insertions(+), 5 deletions(-)
libdm/libdm-stats.c +5 -5
index 3078596..deb20c9 100644
@@ -4869,24 +4869,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;
 }