From: Jes Sorensen Date: Thu, 11 Aug 2016 19:32:34 +0000 (-0400) Subject: config: Use xcalloc() rather than xmalloc()+memset() X-Git-Tag: mdadm-4.0~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a674388f856068babaf2b9152571c56005e5cb4;p=thirdparty%2Fmdadm.git config: Use xcalloc() rather than xmalloc()+memset() Signed-off-by: Jes Sorensen --- diff --git a/config.c b/config.c index b308b6cc..563e24c4 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; idevname = xstrdup(globbuf.gl_pathv[i]); t->next = dlist; dlist = t;