commit 643138ebb35c3fde52e491bce01c94d6dd5c22b1 parent 52dae2da3ecb182a26eafc1e5178ae974e00859d Author: sin <sin@2f30.org> Date: Thu, 17 Dec 2015 14:03:57 +0000 Free memory if readfile() fails Diffstat:
M | util.c | | | 1 | + |
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/util.c b/util.c @@ -141,6 +141,7 @@ readfile(char *file, char **b, size_t *n) } *b = emalloc(*n = sb.st_size); if (read(fd, *b, *n) != (ssize_t)*n) { + free(*b); close(fd); return -1; }