]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
Remove scattered checks for malloc success.
[thirdparty/mdadm.git] / super0.c
index c8cbb9d96230a8ae386d7424b0b71b3040d1d9ff..55e71e8c582fe9d8b91ced8c9ed7cff5a20edc61 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -418,7 +418,7 @@ static struct mdinfo *container_content0(struct supertype *st, char *subarray)
        if (subarray)
                return NULL;
 
-       info = malloc(sizeof(*info));
+       info = xmalloc(sizeof(*info));
        getinfo_super0(st, info, NULL);
        return info;
 }
@@ -710,7 +710,7 @@ static int add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
        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 = *dinfo;
@@ -942,9 +942,7 @@ static int load_super0(struct supertype *st, int fd, char *devname)
 
 static struct supertype *match_metadata_desc0(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 = &super0;