[PATCH 05/13] Handle malloc() failure in Examine.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
---
 Examine.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/Examine.c b/Examine.c
index 5d71e53..74b5f80 100644
--- a/Examine.c
+++ b/Examine.c
@@ -131,6 +131,11 @@ int Examine(struct mddev_dev *devlist, int brief, int export, int scan,
 			}
 			if (!ap) {
 				ap = malloc(sizeof(*ap));
+				if (!ap) {
+					fprintf(stderr, Name ": %s unable to "
+						"allocate memory\n", __func__);
+					return -ENOMEM;
+				}
 				ap->devs = dl_head();
 				ap->next = arrays;
 				ap->spares = 0;
-- 
1.7.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux