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

cov: dmstats check for failing malloc

Add missing check for allocation success.
This commit is contained in:
Zdenek Kabelac 2018-10-15 14:58:24 +02:00
parent 30b1b57506
commit 9b71212262

View File

@ -5224,7 +5224,10 @@ static int _do_stats_create_regions(struct dm_stats *dms,
if (!segments || (info.target_count == 1)) if (!segments || (info.target_count == 1))
region_ids = &region_id; region_ids = &region_id;
else 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 { do {
uint64_t segment_start, segment_len; uint64_t segment_start, segment_len;