diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2018-10-15 14:58:24 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2018-10-15 17:49:44 +0200 |
commit | 9b7121226258f7dfe759cc1f8625cbfb80fec161 (patch) | |
tree | 3fd8feb9d7502504c81d04556f3bade79d25187f | |
parent | 30b1b575067bcab27ab1788247754b183387f55e (diff) | |
download | lvm2-9b7121226258f7dfe759cc1f8625cbfb80fec161.tar.gz |
cov: dmstats check for failing malloc
Add missing check for allocation success.
-rw-r--r-- | libdm/dm-tools/dmsetup.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c index fb1a5747c..835fdcdc7 100644 --- a/libdm/dm-tools/dmsetup.c +++ b/libdm/dm-tools/dmsetup.c @@ -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; |