summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2016-08-11 15:32:34 -0400
committerJes Sorensen <Jes.Sorensen@redhat.com>2016-08-11 15:32:34 -0400
commit6a674388f856068babaf2b9152571c56005e5cb4 (patch)
treecf4d0a9c7b5e7409489e39b9b084ed953344ada3
parentc01222305657378be96f2f9fe359ba33f914c177 (diff)
downloadmdadm-6a674388f856068babaf2b9152571c56005e5cb4.tar.gz
config: Use xcalloc() rather than xmalloc()+memset()
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
-rw-r--r--config.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/config.c b/config.c
index b308b6c..563e24c 100644
--- a/config.c
+++ b/config.c
@@ -144,8 +144,7 @@ struct mddev_dev *load_partitions(void)
name = map_dev(major, minor, 1);
if (!name)
continue;
- d = xmalloc(sizeof(*d));
- memset(d, 0, sizeof(*d));
+ d = xcalloc(1, sizeof(*d));
d->devname = xstrdup(name);
d->next = rv;
rv = d;
@@ -169,8 +168,7 @@ struct mddev_dev *load_containers(void)
if (ent->metadata_version &&
strncmp(ent->metadata_version, "external:", 9) == 0 &&
!is_subarray(&ent->metadata_version[9])) {
- d = xmalloc(sizeof(*d));
- memset(d, 0, sizeof(*d));
+ d = xcalloc(1, sizeof(*d));
me = map_by_devnm(&map, ent->devnm);
if (me)
d->devname = xstrdup(me->path);
@@ -971,8 +969,8 @@ struct mddev_dev *conf_get_devs()
}
if (flags & GLOB_APPEND) {
for (i=0; i<globbuf.gl_pathc; i++) {
- struct mddev_dev *t = xmalloc(sizeof(*t));
- memset(t, 0, sizeof(*t));
+ struct mddev_dev *t;
+ t = xcalloc(1, sizeof(*t));
t->devname = xstrdup(globbuf.gl_pathv[i]);
t->next = dlist;
dlist = t;