]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Create() check malloc() return value
authorJes Sorensen <Jes.Sorensen@redhat.com>
Sat, 22 Oct 2011 00:33:53 +0000 (11:33 +1100)
committerNeilBrown <neilb@suse.de>
Sat, 22 Oct 2011 00:33:53 +0000 (11:33 +1100)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Create.c

index 3e85785468a336f7f54720b53e34c7367848e9c9..5d1548b20329f3f434ca04661fa19a777e81eb32 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -790,6 +790,10 @@ int Create(struct supertype *st, char *mddev,
        }
 
        infos = malloc(sizeof(*infos) * total_slots);
+       if (!infos) {
+               fprintf(stderr, Name ": Unable to allocate memory\n");
+               goto abort;
+       }
 
        for (pass=1; pass <=2 ; pass++) {
                struct mddev_dev *moved_disk = NULL; /* the disk that was moved out of the insert point */