From: Laurent Mazet Date: Wed, 19 Jun 2024 10:17:14 +0000 (+0200) Subject: fix errors reported by valgrind X-Git-Tag: v1.0~1 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=91fce78fb2c9cd132b8377a6bb9998b2ead06fbc;p=scrabble.git fix errors reported by valgrind --- 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);