[hackers] [sent] [PATCH] Check return value of calloc in ffload

From: David Phillips <david_AT_sighup.nz>
Date: Wed, 2 Nov 2016 11:39:36 +1300

---
 sent.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sent.c b/sent.c
index 82acd81..1518015 100644
--- a/sent.c
+++ b/sent.c
_AT_@ -210,7 +210,9 @@ ffload(Slide *s)
 	if (memcmp("farbfeld", hdr, 8))
 		die("sent: Filtered file '%s' has no valid farbfeld header", filename);
 
-	s->img = calloc(1, sizeof(Image));
+	if (!(s->img = calloc(1, sizeof(Image))))
+		die("sent: Unable to allocate image:");
+
 	s->img->bufwidth = ntohl(*(uint32_t *)&hdr[8]);
 	s->img->bufheight = ntohl(*(uint32_t *)&hdr[12]);
 
-- 
2.10.2

Received on Tue Nov 01 2016 - 23:39:36 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 01 2016 - 23:48:15 CET