master - cov: dmstats check for failing malloc
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9b7121226258f7dfe759cc1f8625cbfb80fec161 Commit: 9b7121226258f7dfe759cc1f8625cbfb80fec161 Parent: 30b1b575067bcab27ab1788247754b183387f55e Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Oct 15 14:58:24 2018 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Oct 15 17:49:44 2018 +0200
cov: dmstats check for failing malloc
Add missing check for allocation success.
--- libdm/dm-tools/dmsetup.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
libdm/dm-tools/dmsetup.c +4 -1
@@ -5224,7 +5224,10 @@ static int _do_stats_create_regions(struct dm_stats *dms,if (!segments || (info.target_count ==1 )) region_ids = ®ion_id;else - region_ids =malloc (info.target_count *sizeof (*region_ids)); +if (!(region_ids =malloc (info.target_count *sizeof (*region_ids)))) { +log_error ("Failed to allocated region IDs." ); + goto out; + } do { uint64_t segment_start, segment_len;