mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
filters: Alwayz zalloc the filter struct.
Not all pointers need to be initialised explicitly that way.
This commit is contained in:
parent
376cb3fe64
commit
012d273ede
@ -64,7 +64,7 @@ struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
|
||||
memcpy(filters_copy, filters, sizeof(*filters) * n);
|
||||
filters_copy[n] = NULL;
|
||||
|
||||
if (!(cft = dm_malloc(sizeof(*cft)))) {
|
||||
if (!(cft = dm_zalloc(sizeof(*cft)))) {
|
||||
log_error("compsoite filters allocation failed");
|
||||
dm_free(filters_copy);
|
||||
return NULL;
|
||||
|
@ -54,7 +54,7 @@ struct dev_filter *md_filter_create(void)
|
||||
{
|
||||
struct dev_filter *f;
|
||||
|
||||
if (!(f = dm_malloc(sizeof(*f)))) {
|
||||
if (!(f = dm_zalloc(sizeof(*f)))) {
|
||||
log_error("md filter allocation failed");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ struct dev_filter *mpath_filter_create(const char *sysfs_dir)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(f = dm_malloc(sizeof(*f)))) {
|
||||
if (!(f = dm_zalloc(sizeof(*f)))) {
|
||||
log_error("mpath filter allocation failed");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ struct dev_filter *persistent_filter_create(struct dev_filter *real,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (!(f = dm_malloc(sizeof(*f)))) {
|
||||
if (!(f = dm_zalloc(sizeof(*f)))) {
|
||||
log_error("Allocation of device filter for persistent filter failed.");
|
||||
goto bad;
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ struct dev_filter *lvm_type_filter_create(const char *proc,
|
||||
{
|
||||
struct dev_filter *f;
|
||||
|
||||
if (!(f = dm_malloc(sizeof(struct dev_filter)))) {
|
||||
if (!(f = dm_zalloc(sizeof(struct dev_filter)))) {
|
||||
log_error("LVM type filter allocation failed");
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user