[PATCH 2/2] Create() check malloc() return value
From: <hidden>
Date: 2011-10-21 15:15:59
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: <hidden>
Date: 2011-10-21 15:15:59
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Jes Sorensen <redacted> Signed-off-by: Jes Sorensen <redacted> --- Create.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Create.c b/Create.c
index 3e85785..5d1548b 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 */
--
1.7.4.4