From: Jes Sorensen Date: Sat, 22 Oct 2011 00:33:53 +0000 (+1100) Subject: Create() check malloc() return value X-Git-Tag: mdadm-3.2.3~119 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e69104392b6f13b89c78280a055bce369fcd8ff7;p=thirdparty%2Fmdadm.git Create() check malloc() return value Signed-off-by: Jes Sorensen Signed-off-by: NeilBrown --- 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 */