[PATCH 13/13] 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>
---
 policy.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/policy.c b/policy.c
index 7959c97..4908ab6 100644
--- a/policy.c
+++ b/policy.c
@@ -47,6 +47,11 @@ static void pol_new(struct dev_policy **pol, char *name, const char *val,
 	const char *real_metadata = NULL;
 	int i;
 
+	if (!n) {
+		fprintf(stderr, Name ": %s unable to allocate memory\n",
+			__func__);
+		return;
+	}
 	n->name = name;
 	n->value = val;
 
-- 
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