summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2011-10-22 11:33:53 +1100
committerNeilBrown <neilb@suse.de>2011-10-22 11:33:53 +1100
commite69104392b6f13b89c78280a055bce369fcd8ff7 (patch)
treea5eed74a1c258242f69173a6d6ce8f4568c053e5
parente06af9dd628c6b1c5525f069bbcd824bcc0e37db (diff)
Create() check malloc() return value
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--Create.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Create.c b/Create.c
index 3e857854..5d1548b2 100644
--- 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 */