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);
|
info = dm_hash_lookup(s->vgid_to_info, uuid);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
info = malloc(sizeof(struct vg_info));
|
if (!(info = dm_zalloc(sizeof(struct vg_info))))
|
||||||
if (!info)
|
|
||||||
goto bad;
|
goto bad;
|
||||||
memset(info, 0, sizeof(struct vg_info));
|
|
||||||
if (!dm_hash_insert(s->vgid_to_info, uuid, (void*)info))
|
if (!dm_hash_insert(s->vgid_to_info, uuid, (void*)info))
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
@ -102,11 +102,9 @@ struct dm_hash_table *dm_hash_create(unsigned size_hint)
|
|||||||
|
|
||||||
hc->num_slots = new_size;
|
hc->num_slots = new_size;
|
||||||
len = sizeof(*(hc->slots)) * new_size;
|
len = sizeof(*(hc->slots)) * new_size;
|
||||||
if (!(hc->slots = dm_malloc(len))) {
|
if (!(hc->slots = dm_zalloc(len)))
|
||||||
stack;
|
goto_bad;
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
memset(hc->slots, 0, len);
|
|
||||||
return hc;
|
return hc;
|
||||||
|
|
||||||
bad:
|
bad:
|
||||||
|
@ -1156,11 +1156,9 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
|
|||||||
while (repeat_count--)
|
while (repeat_count--)
|
||||||
len *= 2;
|
len *= 2;
|
||||||
|
|
||||||
if (!(dmi = dm_malloc(len)))
|
if (!(dmi = dm_zalloc(len)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(dmi, 0, len);
|
|
||||||
|
|
||||||
version = &_cmd_data_v4[dmt->type].version;
|
version = &_cmd_data_v4[dmt->type].version;
|
||||||
|
|
||||||
dmi->version[0] = (*version)[0];
|
dmi->version[0] = (*version)[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user