From 91fce78fb2c9cd132b8377a6bb9998b2ead06fbc Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Wed, 19 Jun 2024 12:17:14 +0200 Subject: [PATCH] fix errors reported by valgrind --- function.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/function.c b/function.c index 692c52f..f217027 100644 --- a/function.c +++ b/function.c @@ -104,6 +104,7 @@ draw_t *newdraw (int nbtiles) CHECKALLOC (draw->tiles); memset (draw->tiles, ' ', nbtiles); draw->nbtiles = nbtiles; + draw->index = -1; return draw; } @@ -609,7 +610,7 @@ char *loaddata (char *filename) if (fd) { fseek (fd, 0, SEEK_END); int size = ftell (fd); - buffer = (char *) calloc (size, 1); + buffer = (char *) calloc (size + 1, 1); CHECKALLOC (buffer); fseek (fd, 0, SEEK_SET); -- 2.30.2