]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
match_metadata_desc1(): Use calloc instead of malloc+memset
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 20 Mar 2012 21:00:50 +0000 (08:00 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 20 Mar 2012 21:00:50 +0000 (08:00 +1100)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super1.c

index 4da599179e27aa376f8e3ae5348efc05d90ea915..61655ada36f922addf05ceee04127442b4d03c7a 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -1408,10 +1408,10 @@ static int load_super1(struct supertype *st, int fd, char *devname)
 
 static struct supertype *match_metadata_desc1(char *arg)
 {
-       struct supertype *st = malloc(sizeof(*st));
-       if (!st) return st;
+       struct supertype *st = calloc(1, sizeof(*st));
+       if (!st)
+               return st;
 
-       memset(st, 0, sizeof(*st));
        st->container_dev = NoMdDev;
        st->ss = &super1;
        st->max_devs = MAX_DEVS;