mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cleanup: use zalloc
Replace malloc() + memset() with zalloc().
This commit is contained in:
parent
5c40e81a7e
commit
c82ab92d04
@ -2528,10 +2528,8 @@ inval:
|
||||
|
||||
info = dm_hash_lookup(s->vgid_to_info, uuid);
|
||||
if (!info) {
|
||||
info = malloc(sizeof(struct vg_info));
|
||||
if (!info)
|
||||
if (!(info = dm_zalloc(sizeof(struct vg_info))))
|
||||
goto bad;
|
||||
memset(info, 0, sizeof(struct vg_info));
|
||||
if (!dm_hash_insert(s->vgid_to_info, uuid, (void*)info))
|
||||
goto bad;
|
||||
}
|
||||
|
@ -102,11 +102,9 @@ struct dm_hash_table *dm_hash_create(unsigned size_hint)
|
||||
|
||||
hc->num_slots = new_size;
|
||||
len = sizeof(*(hc->slots)) * new_size;
|
||||
if (!(hc->slots = dm_malloc(len))) {
|
||||
stack;
|
||||
goto bad;
|
||||
}
|
||||
memset(hc->slots, 0, len);
|
||||
if (!(hc->slots = dm_zalloc(len)))
|
||||
goto_bad;
|
||||
|
||||
return hc;
|
||||
|
||||
bad:
|
||||
|
@ -1156,11 +1156,9 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
|
||||
while (repeat_count--)
|
||||
len *= 2;
|
||||
|
||||
if (!(dmi = dm_malloc(len)))
|
||||
if (!(dmi = dm_zalloc(len)))
|
||||
return NULL;
|
||||
|
||||
memset(dmi, 0, len);
|
||||
|
||||
version = &_cmd_data_v4[dmt->type].version;
|
||||
|
||||
dmi->version[0] = (*version)[0];
|
||||
|
Loading…
Reference in New Issue
Block a user