[PATCH 01/13] count_active() catch malloc() failure

[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>
---
 Incremental.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Incremental.c b/Incremental.c
index c21c971..35f0ce7 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -756,6 +756,10 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
 
 			best = calloc(raid_disks, sizeof(int));
 			devmap = calloc(raid_disks * numdevs, 1);
+			if (!best || !devmap) {
+				fprintf(stderr, Name ": out of memory.\n");
+				exit(1);
+			}
 
 			st->ss->getinfo_super(st, &info, devmap);
 		}
-- 
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