]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super1.c
Remove scattered checks for malloc success.
[thirdparty/mdadm.git] / super1.c
index 5c6530ed66f51bf2088d57b92ddf071611ba2e59..ff7c967d2a41d1f9a24b7cbca7fc45ee231556be 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -695,7 +695,7 @@ static struct mdinfo *container_content1(struct supertype *st, char *subarray)
        if (subarray)
                return NULL;
 
-       info = malloc(sizeof(*info));
+       info = xmalloc(sizeof(*info));
        getinfo_super1(st, info, NULL);
        return info;
 }
@@ -978,7 +978,7 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
        dip = (struct devinfo **)&st->info;
        while (*dip)
                dip = &(*dip)->next;
-       di = malloc(sizeof(struct devinfo));
+       di = xmalloc(sizeof(struct devinfo));
        di->fd = fd;
        di->devname = devname;
        di->disk = *dk;
@@ -1454,9 +1454,7 @@ static int load_super1(struct supertype *st, int fd, char *devname)
 
 static struct supertype *match_metadata_desc1(char *arg)
 {
-       struct supertype *st = calloc(1, sizeof(*st));
-       if (!st)
-               return st;
+       struct supertype *st = xcalloc(1, sizeof(*st));
 
        st->container_dev = NoMdDev;
        st->ss = &super1;