From 012d273ede86f0e3e894b0e907f7f623c3dda7e0 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Sat, 18 Aug 2012 18:59:07 +0200 Subject: [PATCH] filters: Alwayz zalloc the filter struct. Not all pointers need to be initialised explicitly that way. --- lib/filters/filter-composite.c | 2 +- lib/filters/filter-md.c | 2 +- lib/filters/filter-mpath.c | 2 +- lib/filters/filter-persistent.c | 2 +- lib/filters/filter.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/filters/filter-composite.c b/lib/filters/filter-composite.c index 130490af3..3ed87870c 100644 --- a/lib/filters/filter-composite.c +++ b/lib/filters/filter-composite.c @@ -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; diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c index e3e88f113..d57489d85 100644 --- a/lib/filters/filter-md.c +++ b/lib/filters/filter-md.c @@ -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; } diff --git a/lib/filters/filter-mpath.c b/lib/filters/filter-mpath.c index 6d6353aa5..61a62d738 100644 --- a/lib/filters/filter-mpath.c +++ b/lib/filters/filter-mpath.c @@ -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; } diff --git a/lib/filters/filter-persistent.c b/lib/filters/filter-persistent.c index 370580485..79e40b8ed 100644 --- a/lib/filters/filter-persistent.c +++ b/lib/filters/filter-persistent.c @@ -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; } diff --git a/lib/filters/filter.c b/lib/filters/filter.c index dcb6c5ef4..e33504531 100644 --- a/lib/filters/filter.c +++ b/lib/filters/filter.c @@ -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; }