1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

coverity: fix mem leak on error path in dm stats

Free allocated resouces on error path.
This commit is contained in:
Zdenek Kabelac 2017-02-11 21:17:41 +01:00
parent 0844b20f98
commit a7d2ee4bc2

View File

@ -4842,7 +4842,7 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
if (!bounds) { if (!bounds) {
log_error("Could not allocate memory for group " log_error("Could not allocate memory for group "
"histogram bounds."); "histogram bounds.");
return NULL; goto out;
} }
_stats_copy_histogram_bounds(bounds, _stats_copy_histogram_bounds(bounds,
dms->regions[group_id].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: bad:
_stats_cleanup_region_ids(dms, regions, count); _stats_cleanup_region_ids(dms, regions, count);
dm_free(bounds); dm_free(bounds);
dm_free(regions);
out:
dm_free((char *) alias); dm_free((char *) alias);
return NULL; return NULL;
} }