From a7d2ee4bc2dd032cd15db028b3c118ce7138c854 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sat, 11 Feb 2017 21:17:41 +0100 Subject: [PATCH] coverity: fix mem leak on error path in dm stats Free allocated resouces on error path. --- libdm/libdm-stats.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c index f68874cae..032be0391 100644 --- a/libdm/libdm-stats.c +++ b/libdm/libdm-stats.c @@ -4842,7 +4842,7 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd, if (!bounds) { log_error("Could not allocate memory for group " "histogram bounds."); - return NULL; + goto out; } _stats_copy_histogram_bounds(bounds, dms->regions[group_id].bounds); @@ -4869,6 +4869,8 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd, bad: _stats_cleanup_region_ids(dms, regions, count); dm_free(bounds); + dm_free(regions); +out: dm_free((char *) alias); return NULL; } -- 2.43.5