Blame SOURCES/0011-Fix-missing-allocation-check-in-read_script_output.patch

39593f
From 95d287071663ef5a0025c8ee136b31c905b63ae0 Mon Sep 17 00:00:00 2001
39593f
From: Jan Zeleny <jzeleny@redhat.com>
39593f
Date: Wed, 30 Jul 2014 10:24:26 +0200
39593f
Subject: [PATCH] Fix missing allocation check in read_script_output()
39593f
39593f
---
39593f
 scl.c | 5 ++++-
39593f
 1 file changed, 4 insertions(+), 1 deletion(-)
39593f
39593f
diff --git a/scl.c b/scl.c
39593f
index fcdebcbfd35dec2c4ff68536bc90771d439fc044..907f368a58f6f1b4ba75ec62ad95ebb535778903 100644
39593f
--- a/scl.c
39593f
+++ b/scl.c
39593f
@@ -217,7 +217,10 @@ static char **read_script_output( char *ori_cmd ) {
39593f
 	unlink(tmp);
39593f
 
39593f
 	ls = 0x100;
39593f
-	lines = malloc(ls*sizeof(char*));
39593f
+	if ((lines = (char **)malloc(ls*sizeof(char*))) == NULL) {
39593f
+		fprintf(stderr, "Unable to allocate memory.\n");
39593f
+		exit(EXIT_FAILURE);
39593f
+	}
39593f
 	*lines = NULL;
39593f
 
39593f
 	for (mp=m; mp && mp < &m[sb.st_size];) {
39593f
-- 
39593f
1.9.3
39593f