[hackers] [sent] check memory allocation for calloc, die on failure || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Fri, 4 Nov 2016 19:49:15 +0100 (CET)

commit 8185d5eacbcd3fc2420e752e8175c05b9a35b9b3
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Fri Aug 12 13:09:36 2016 +0200
Commit: Markus Teich <markus.teich_AT_stusta.mhn.de>
CommitDate: Mon Oct 10 20:51:15 2016 +0200

    check memory allocation for calloc, die on failure

diff --git a/sent.c b/sent.c
index 82acd81..5fce290 100644
--- a/sent.c
+++ b/sent.c
_AT_@ -210,7 +210,7 @@ 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));
+ s->img = ecalloc(1, sizeof(Image));
         s->img->bufwidth = ntohl(*(uint32_t *)&hdr[8]);
         s->img->bufheight = ntohl(*(uint32_t *)&hdr[12]);
 
Received on Fri Nov 04 2016 - 19:49:15 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 04 2016 - 20:00:21 CET